-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.ps1
71 lines (64 loc) · 2.97 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#######################################
# Test build setup for Vehicle_Detector with _pyinstaller_
#
# Copyright 2020 by Smendwoski Mateusz, Sladowski Piotr, Twardosz Adam
#######################################
# Storing caller working directory
$uwd = $PWD
# Setting script working directory
Set-Location -ErrorAction Stop -LiteralPath $PSScriptRoot
# Find local dll's
$vlcInstalled = 0
$vlcLine = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ | Get-ItemProperty | Select-Object DisplayName, InstallLocation | Where-Object {$_.DisplayName -like "VLC media player"}
if ($vlcLine.Length -gt 0) {
$vlcInstalled = 1
$libvlcPath = $vlcLine.InstallLocation + "\libvlc.dll"
New-Item -ItemType Directory -Force -Path "./dlls"
Copy-Item $libvlcPath -Destination "./dlls/libvlc.dll"
}
$ffmpeg = 0
$ffmpegLine = $env:Path.Split(';') | Select-String -pattern 'ffmpeg'
if ($ffmpegLine.Length -gt 0) {
$ffmpeg = 1
Write-Host "ffmpeg already installed"
} elseif ((choco --version).Length -gt 0) {
if ((choco list --local | Select-String -pattern "ffmpeg").Length -gt 0) {
$ffmpeg = 1
Write-Host "ffmpeg already installed with chocolatey"
}
} elseif ((scoop).Length -eq 30) {
if ((scoop list | Select-String -pattern "ffmpeg").Length -gt 0) {
$ffmpeg = 1
Write-Host "ffmpeg already installed with scoop"
}
}
# Then download necessary files
# YOLO MODELS' yolovX.weights
if (!(Test-Path -Path "./src/model/yolov3.weights")) {
Invoke-WebRequest -Uri "https://pjreddie.com/media/files/yolov3.weights" -OutFile "./src/model/yolov3.weights"
}
if (!(Test-Path -Path "./src/model/yolov3-tiny.weights")) {
Invoke-WebRequest -Uri "https://pjreddie.com/media/files/yolov3-tiny.weights" -OutFile "./src/model/yolov3-tiny.weights"
}
if (!(Test-Path -Path "./src/model/yolov4.weights")) {
Invoke-WebRequest -Uri "https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov4.weights" -Outfile "./src/model/yolov4.weights"
}
# libvlc.dll download (if not found on system hard drive)
if ($vlcInstalled -eq 0) {
New-Item -ItemType Directory -Force -Path "./dlls"
Invoke-WebRequest -Uri "https://api.onedrive.com/v1.0/shares/u!aHR0cHM6Ly8xZHJ2Lm1zL3UvcyFBcnVsR3pSOEsyS0NoTUJjRUw3VEJ4OHR0eWlEMFE_ZT02TUVPR0I/root/content" -OutFile "./dlls/libvlc.dll"
}
if ($ffmpeg -eq 0) {
Invoke-WebRequest -Uri "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2020-12-07-12-50/ffmpeg-N-100214-g95fd790c14-win64-gpl-vulkan.zip" -OutFile "./ffmpeg.zip"
Expand-Archive "./ffmpeg.zip" -DestinationPath "./ffmpeg/"
Copy-Item "./ffmpeg/ffmpeg-N-100214-g95fd790c14-win64-gpl-vulkan/bin/ffmpeg.exe" -Destination "./"
Copy-Item "./ffmpeg/ffmpeg-N-100214-g95fd790c14-win64-gpl-vulkan/bin/ffprobe.exe" -Destination "./"
Remove-Item -Recurse "./ffmpeg"
Remove-Item "./ffmpeg.zip"
}
# venv section
pip3 install virtualenv
virtualenv env
./env/Scripts/activate
pip3 install -r ./requirements.txt
# end setup