Skip to content

Commit 583c622

Browse files
authored
Merge pull request #83 from johnolafenwa/johnolafenwa/windows
Johnolafenwa/windows
2 parents ff66441 + c9bc615 commit 583c622

File tree

17 files changed

+244
-22
lines changed

17 files changed

+244
-22
lines changed

.github/workflows/pr_test.yml

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- dev
1010
- master
1111
jobs:
12-
build:
12+
docker-build:
1313
runs-on: ubuntu-20.04
1414
steps:
1515
- name: Checkout repo
@@ -72,4 +72,40 @@ jobs:
7272
export TEST_DEEPSTACK_URL="http://localhost:80"
7373
cd custom
7474
python3 -m pytest
75-
sudo docker container rm -f deepstack
75+
sudo docker container rm -f deepstack
76+
windows-build:
77+
runs-on: windows-2019
78+
steps:
79+
- name: Checkout repo
80+
uses: actions/checkout@master
81+
- name: Fetch GIT LFS
82+
run: git lfs checkout && git lfs pull
83+
- name: Install python
84+
uses: actions/setup-python@v2
85+
with:
86+
python-version: "3.7"
87+
- name: Install Pytest and Requests
88+
run: pip install pytest requests
89+
- name: Setup Golang
90+
uses: actions/setup-go@v2
91+
- name: Build DeepStack Go Component
92+
run: cd server && go build -o deepstack.exe
93+
- name: Generate CPU Build Script
94+
run: .\generate_windows_setup.ps1 -Platform CPU -Version 1.0
95+
- name: Build CPU Version
96+
run: .\build_windows.ps1
97+
- name: Install DeepStack CPU Version
98+
run: |
99+
$deepstack_installer = [System.IO.Directory]::GetCurrentDirectory()+"\Output\DeepStack-Installer-CPU.exe"
100+
Start-Process -FilePath $deepstack_installer -ArgumentList "/VERYSILENT" -Wait -NoNewWindow
101+
- name: Test Scene
102+
run: |
103+
cd tests
104+
$ErrorActionPreference = "Stop"
105+
$env:TEST_DATA_DIR=[System.IO.Directory]::GetCurrentDirectory()+"\tests\test_data"
106+
$env:TEST_DEEPSTACK_URL="http://localhost:80"
107+
Start-Process -FilePath "C:\DeepStack\deepstack.exe" -ArgumentList "--PORT 80" -NoNewWindow
108+
Start-Sleep 30
109+
cd scene
110+
python -m pytest
111+

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ __pycache__/
33
*.py[cod]
44
*$py.class
55

6+
*.err
7+
*.out
8+
*.iss
9+
!environment.iss
10+
611
# C extensions
712
*.so
813

Dockerfile.arm64

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM deepquestai/deepstack-base:arm64 as arm
2+
3+
ENV SLEEP_TIME 0.01
4+
ENV CUDA_MODE False
5+
ENV APPDIR /app
6+
7+
RUN mkdir /deeptemp
8+
RUN mkdir /datastore
9+
10+
ENV DATA_DIR /datastore
11+
ENV TEMP_PATH /deeptemp/
12+
ENV PROFILE jetson
13+
14+
WORKDIR /app
15+
16+
RUN pip3 install redis
17+
RUN pip3 install Cython
18+
RUN pip3 install pillow
19+
RUN pip3 install scipy
20+
RUN pip3 install tqdm
21+
RUN pip3 install PyYAML
22+
23+
RUN mkdir /app/sharedfiles
24+
COPY ./sharedfiles/yolov5s.pt /app/sharedfiles/yolov5s.pt
25+
COPY ./sharedfiles/face_lite.pt /app/sharedfiles/face_lite.pt
26+
COPY ./sharedfiles/facerec-high.model /app/sharedfiles/facerec-high.model
27+
COPY ./sharedfiles/scene.pt /app/sharedfiles/scene.pt
28+
COPY ./sharedfiles/categories_places365.txt /app/sharedfiles/categories_places365.txt
29+
30+
RUN mkdir /app/server
31+
COPY ./server /app/server
32+
33+
RUN mkdir /app/intelligencelayer
34+
COPY ./intelligencelayer /app/intelligencelayer
35+
36+
COPY ./init.py /app
37+
38+
EXPOSE 5000
39+
40+
WORKDIR /app/server
41+
42+
CMD ["/app/server/server"]

Dockerfile.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN mkdir /app/sharedfiles
2828
COPY ./sharedfiles/yolov5m.pt /app/sharedfiles/yolov5m.pt
2929
COPY ./sharedfiles/face.pt /app/sharedfiles/face.pt
3030
COPY ./sharedfiles/facerec-high.model /app/sharedfiles/facerec-high.model
31-
COPY ./sharedfiles/scene.model /app/sharedfiles/scene.model
31+
COPY ./sharedfiles/scene.pt /app/sharedfiles/scene.pt
3232
COPY ./sharedfiles/categories_places365.txt /app/sharedfiles/categories_places365.txt
3333

3434
RUN mkdir /app/server

Dockerfile.gpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN mkdir /app/sharedfiles
2828
COPY ./sharedfiles/yolov5m.pt /app/sharedfiles/yolov5m.pt
2929
COPY ./sharedfiles/face.pt /app/sharedfiles/face.pt
3030
COPY ./sharedfiles/facerec-high.model /app/sharedfiles/facerec-high.model
31-
COPY ./sharedfiles/scene.model /app/sharedfiles/scene.model
31+
COPY ./sharedfiles/scene.pt /app/sharedfiles/scene.pt
3232
COPY ./sharedfiles/categories_places365.txt /app/sharedfiles/categories_places365.txt
3333

3434
RUN mkdir /app/server

Dockerfile.gpu-jetpack

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RUN mkdir /app/sharedfiles
2727
COPY ./sharedfiles/yolov5s.pt /app/sharedfiles/yolov5s.pt
2828
COPY ./sharedfiles/face_lite.pt /app/sharedfiles/face_lite.pt
2929
COPY ./sharedfiles/facerec-high.model /app/sharedfiles/facerec-high.model
30-
COPY ./sharedfiles/scene.model /app/sharedfiles/scene.model
30+
COPY ./sharedfiles/scene.pt /app/sharedfiles/scene.pt
3131
COPY ./sharedfiles/categories_places365.txt /app/sharedfiles/categories_places365.txt
3232

3333
RUN mkdir /app/server

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
The World's Leading Cross Platform AI Engine for Edge Devices, with over `3.2 million` installs on **Docker Hub**.
33

44
[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
5-
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](hhttps://github.com/johnolafenwa/DeepStack/blob/dev/LICENSE)
5+
6+
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](hhttps://github.com/johnolafenwa/DeepStack/blob/dev/LICENSE)
7+
68
![DevTest](https://github.com/johnolafenwa/DeepStack/workflows/DevTest/badge.svg)
9+
710
**Website**: [https://deepstack.cc](https://deepstack.cc)
811

912
**Documentation**: [https://docs.deepstack.cc](https://docs.deepstack.cc)

build_windows.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
$ErrorActionPreference = "Stop"
2+
Start-Process -FilePath "windows_setup/ISCC.exe" -ArgumentList "deepstack-windows.iss" -Wait -NoNewWindow

generate_windows_setup.ps1

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
param(
2+
[ValidateSet("CPU","GPU")]
3+
[Parameter(Mandatory=$true)]
4+
[string]$Platform,
5+
6+
[Parameter(Mandatory=$true)]
7+
[string]$Version
8+
)
9+
10+
$ErrorActionPreference = "Stop"
11+
12+
$setup_script = "#include ""environment.iss"""
13+
$setup_script += "`n#define MyAppName ""DeepStack"""
14+
$setup_script += "`n#define MyAppVersion ""$Version"""
15+
$setup_script += "`n#define MyAppPublisher ""DeepQuestAI"""
16+
$setup_script += "`n#define MyAppURL ""https://www.deepstack.cc"""
17+
$setup_script += "`n#define MyAppExeName ""deepstack.exe"""
18+
$setup_script += "`n#define MyAppIcon ""logo.ico"""
19+
20+
$setup_script += "`n`n[Setup]"
21+
$setup_script += "`nChangesEnvironment=true"
22+
$setup_script += "`nAppId={{0E2C3125-3440-4622-A82A-3B1E07310EF2}"
23+
$setup_script += "`nAppName={#MyAppName}"
24+
$setup_script += "`nAppVersion={#MyAppVersion}"
25+
$setup_script += "`nAppPublisher={#MyAppPublisher}"
26+
$setup_script += "`nAppPublisherURL={#MyAppURL}"
27+
$setup_script += "`nAppSupportURL={#MyAppURL}"
28+
$setup_script += "`nAppUpdatesURL={#MyAppURL}"
29+
$setup_script += "`nDefaultDirName=C:\{#MyAppName}"
30+
$setup_script += "`nDisableDirPage=yes"
31+
$setup_script += "`nDefaultGroupName=DeepStack"
32+
$setup_script += "`nOutputBaseFilename=DeepStack-Installer-$Platform"
33+
$setup_script += "`nCompression=lzma"
34+
$setup_script += "`nSolidCompression=yes"
35+
36+
$setup_script += "`n`n[Languages]"
37+
$setup_script += "`nName: ""english""; MessagesFile: ""compiler:Default.isl"""
38+
$setup_script += "`nName: ""armenian""; MessagesFile: ""compiler:Languages\Armenian.isl"""
39+
$setup_script += "`nName: ""brazilianportuguese""; MessagesFile: ""compiler:Languages\BrazilianPortuguese.isl"""
40+
$setup_script += "`nName: ""catalan""; MessagesFile: ""compiler:Languages\Catalan.isl"""
41+
$setup_script += "`nName: ""corsican""; MessagesFile: ""compiler:Languages\Corsican.isl"""
42+
$setup_script += "`nName: ""czech""; MessagesFile: ""compiler:Languages\Czech.isl"""
43+
$setup_script += "`nName: ""danish""; MessagesFile: ""compiler:Languages\Danish.isl"""
44+
$setup_script += "`nName: ""dutch""; MessagesFile: ""compiler:Languages\Dutch.isl"""
45+
$setup_script += "`nName: ""finnish""; MessagesFile: ""compiler:Languages\Finnish.isl"""
46+
$setup_script += "`nName: ""french""; MessagesFile: ""compiler:Languages\French.isl"""
47+
$setup_script += "`nName: ""german""; MessagesFile: ""compiler:Languages\German.isl"""
48+
$setup_script += "`nName: ""hebrew""; MessagesFile: ""compiler:Languages\Hebrew.isl"""
49+
$setup_script += "`nName: ""icelandic""; MessagesFile: ""compiler:Languages\Icelandic.isl"""
50+
$setup_script += "`nName: ""italian""; MessagesFile: ""compiler:Languages\Italian.isl"""
51+
$setup_script += "`nName: ""japanese""; MessagesFile: ""compiler:Languages\Japanese.isl"""
52+
$setup_script += "`nName: ""norwegian""; MessagesFile: ""compiler:Languages\Norwegian.isl"""
53+
$setup_script += "`nName: ""polish""; MessagesFile: ""compiler:Languages\Polish.isl"""
54+
$setup_script += "`nName: ""portuguese""; MessagesFile: ""compiler:Languages\Portuguese.isl"""
55+
$setup_script += "`nName: ""russian""; MessagesFile: ""compiler:Languages\Russian.isl"""
56+
$setup_script += "`nName: ""slovak""; MessagesFile: ""compiler:Languages\Slovak.isl"""
57+
$setup_script += "`nName: ""slovenian""; MessagesFile: ""compiler:Languages\Slovenian.isl"""
58+
$setup_script += "`nName: ""spanish""; MessagesFile: ""compiler:Languages\Spanish.isl"""
59+
$setup_script += "`nName: ""turkish""; MessagesFile: ""compiler:Languages\Turkish.isl"""
60+
$setup_script += "`nName: ""ukrainian""; MessagesFile: ""compiler:Languages\Ukrainian.isl"""
61+
62+
63+
$setup_script += "`n`n[Tasks]"
64+
$setup_script += "`nName: ""desktopicon""; Description: ""{cm:CreateDesktopIcon}""; GroupDescription: ""{cm:AdditionalIcons}""; Flags: unchecked"
65+
$setup_script += "`nName: ""quicklaunchicon""; Description: ""{cm:CreateQuickLaunchIcon}""; GroupDescription: ""{cm:AdditionalIcons}""; Flags: unchecked; OnlyBelowVersion: 0,6.1"
66+
67+
$setup_script += "`n`n[Files]"
68+
$setup_script += "`nSource: ""$PSScriptRoot\server\deepstack.exe""; DestDir: ""{app}""; Flags: ignoreversion"
69+
$setup_script += "`nSource: ""$PSScriptRoot\*""; DestDir: ""{app}"";"
70+
$setup_script += "`nSource: ""$PSScriptRoot\intelligencelayer\*""; DestDir: ""{app}\intelligencelayer""; Flags: ignoreversion recursesubdirs createallsubdirs"
71+
$setup_script += "`nSource: ""$PSScriptRoot\interpreter\*""; DestDir: ""{app}\interpreter""; Flags: ignoreversion recursesubdirs createallsubdirs"
72+
$setup_script += "`nSource: ""$PSScriptRoot\redis\*""; DestDir: ""{app}\redis""; Flags: ignoreversion recursesubdirs createallsubdirs"
73+
$setup_script += "`nSource: ""$PSScriptRoot\server\*""; DestDir: ""{app}\server""; Flags: ignoreversion recursesubdirs createallsubdirs"
74+
if($Platform -eq "CPU"){
75+
$setup_script += "`nSource: ""$PSScriptRoot\platform\platform.windows.cpu.json""; DestDir: ""{app}\server""; DestName: ""platform.json""; Flags: ignoreversion"
76+
}
77+
elseif ($Platform -eq "GPU") {
78+
$setup_script += "`nSource: ""$PSScriptRoot\platform\platform.windows.gpu.json""; DestDir: ""{app}\server""; DestName: ""platform.json""; Flags: ignoreversion"
79+
}
80+
$setup_script += "`nSource: ""$PSScriptRoot\server\version.txt""; DestDir: ""{app}\server""; Flags: ignoreversion"
81+
$setup_script += "`nSource: ""$PSScriptRoot\sharedfiles\categories_places365.txt""; DestDir: ""{app}\sharedfiles""; Flags: ignoreversion"
82+
$setup_script += "`nSource: ""$PSScriptRoot\sharedfiles\face.pt""; DestDir: ""{app}\sharedfiles""; Flags: ignoreversion"
83+
$setup_script += "`nSource: ""$PSScriptRoot\sharedfiles\facerec-high.model""; DestDir: ""{app}\sharedfiles""; Flags: ignoreversion"
84+
$setup_script += "`nSource: ""$PSScriptRoot\sharedfiles\scene.pt""; DestDir: ""{app}\sharedfiles""; Flags: ignoreversion"
85+
$setup_script += "`nSource: ""$PSScriptRoot\sharedfiles\yolov5m.pt""; DestDir: ""{app}\sharedfiles""; Flags: ignoreversion"
86+
if($Platform -eq "CPU"){
87+
$setup_script += "`nSource: ""$PSScriptRoot\windows_packages_cpu\*""; DestDir: ""{app}\windows_packages""; Flags: ignoreversion recursesubdirs createallsubdirs"
88+
}
89+
elseif($Platform -eq "GPU"){
90+
$setup_script += "`nSource: ""$PSScriptRoot\windows_packages_gpu\*""; DestDir: ""{app}\windows_packages""; Flags: ignoreversion recursesubdirs createallsubdirs"
91+
}
92+
93+
$setup_script += "`nSource: ""$PSScriptRoot\logo.ico""; DestDir: ""{app}""; Flags: ignoreversion"
94+
$setup_script += "`nSource: ""$PSScriptRoot\init.py""; DestDir: ""{app}""; Flags: ignoreversion"
95+
96+
$setup_script += "`n`n[Icons]"
97+
$setup_script += "`nName: ""{group}\{#MyAppName}""; Filename: ""{app}\{#MyAppExeName}"""
98+
$setup_script += "`nName: ""{group}\{cm:UninstallProgram,{#MyAppName}}""; Filename: ""{uninstallexe}"""
99+
$setup_script += "`nName: ""{commondesktop}\{#MyAppName}""; Filename: ""{app}\{#MyAppExeName}""; IconFilename: {app}\{#MyAppIcon}; Tasks: desktopicon quicklaunchicon"
100+
$setup_script += "`nName: ""{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}""; Filename: ""{app}\{#MyAppExeName}""; IconFilename: {app}\{#MyAppIcon}; Tasks: quicklaunchicon"
101+
102+
$setup_script += "`n[Code]"
103+
$setup_script += "`nprocedure CurStepChanged(CurStep: TSetupStep);"
104+
$setup_script += "`nbegin"
105+
$setup_script += "`n if CurStep = ssPostInstall"
106+
$setup_script += "`n then EnvAddPath(ExpandConstant('{app}') + '\server');"
107+
$setup_script += "`nend;"
108+
109+
$setup_script += "`n`nprocedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);"
110+
$setup_script += "`nbegin"
111+
$setup_script += "`n if CurUninstallStep = usPostUninstall"
112+
$setup_script += "`n then EnvRemovePath(ExpandConstant('{app}' + '\server'));"
113+
$setup_script += "`nend;"
114+
115+
Set-Content -Path "deepstack-windows.iss" -Value $setup_script

intelligencelayer/shared/process.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def __init__(self, model_path: str, reso: int = 640, cuda: bool = False):
4444

4545
def predict(self, img_path: str, confidence: float = 0.4):
4646

47+
confidence = max(0.1,confidence)
48+
4749
img0 = Image.open(img_path).convert("RGB")
4850
img = np.asarray(letterbox(img0, new_shape=self.reso)[0])
4951
img = img[:, :, ::-1].transpose(2, 0, 1)

0 commit comments

Comments
 (0)