forked from tensorflow/models
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDownloadAndBuildProtocolBuffers.ps1
38 lines (27 loc) · 1.23 KB
/
DownloadAndBuildProtocolBuffers.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
$pathToSourceRoot = "C:\Users\Alex\Repositories\MusicObjectDetector-TF\MusicObjectDetector\"
$pathToTranscript = "$($pathToSourceRoot)"
cd $pathToSourceRoot
echo "Appending source root $($pathToSourceRoot) to temporary PYTHONPATH"
$env:PYTHONPATH = $pathToSourceRoot
Start-Transcript -path "$($pathToTranscript)Transcript.txt" -append
# Compile Protoc files
Add-Type -AssemblyName System.IO.Compression.FileSystem
function Unzip
{
param([string]$zipfile, [string]$outpath)
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}
$url = "https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-win32.zip"
$output = $pathToSourceRoot + "protoc-3.4.0-win32.zip"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $url -OutFile $output
$protoc_folder = $pathToSourceRoot + "Protoc"
Unzip $output $protoc_folder
.\Protoc\bin\protoc.exe --version
cd ..\research
..\MusicObjectDetector\Protoc\bin\protoc.exe object_detection/protos/*.proto --python_out=.
rm ..\MusicObjectDetector\Protoc -Recurse
rm ..\MusicObjectDetector\protoc-3.4.0-win32.zip
echo "Verifying correct installation..."
python object_detection\builders\model_builder_test.py
Stop-Transcript