Skip to content

Commit caea44b

Browse files
authored
Merge pull request #60 from johnolafenwa/johnolafenwa/windows
Johnolafenwa/windows
2 parents 93185cc + d40a118 commit caea44b

File tree

9,200 files changed

+3925974
-122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

9,200 files changed

+3925974
-122
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ __pycache__/
66
# C extensions
77
*.so
88

9+
*.exe
10+
!windows_packages/*.exe
11+
!redis/*.exe
12+
!interpreter/*.exe
13+
914
# Distribution / packaging
1015
.Python
1116
build/
1217
develop-eggs/
1318
dist/
1419
downloads/
20+
logs
1521
eggs/
1622
.eggs/
1723
lib/
@@ -26,7 +32,6 @@ share/python-wheels/
2632
*.egg
2733
MANIFEST
2834
server/server
29-
3035
# PyInstaller
3136
# Usually these files are written by a python script from a template
3237
# before PyInstaller builds the exe, so as to inject date/other infos into it.

deepstack-setup-cpu.iss

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
; Script generated by the Inno Script Studio Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
#include "environment.iss"
4+
#define MyAppName "DeepStack"
5+
#define MyAppVersion "2021.01.beta"
6+
#define MyAppPublisher "DeepQuestAI"
7+
#define MyAppURL "https://www.deepstack.cc"
8+
#define MyAppExeName "deepstack.exe"
9+
#define MyAppIcon "logo.ico"
10+
11+
[Setup]
12+
ChangesEnvironment=true
13+
; NOTE: The value of AppId uniquely identifies this application.
14+
; Do not use the same AppId value in installers for other applications.
15+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
16+
AppId={{0E2C3125-3440-4622-A82A-3B1E07310EF2}
17+
AppName={#MyAppName}
18+
AppVersion={#MyAppVersion}
19+
;AppVerName={#MyAppName} {#MyAppVersion}
20+
AppPublisher={#MyAppPublisher}
21+
AppPublisherURL={#MyAppURL}
22+
AppSupportURL={#MyAppURL}
23+
AppUpdatesURL={#MyAppURL}
24+
DefaultDirName=C:\{#MyAppName}
25+
DisableDirPage=yes
26+
DefaultGroupName=DeepStack
27+
OutputBaseFilename=DeepStack-Installer-CPU.2021.01.beta
28+
Compression=lzma
29+
SolidCompression=yes
30+
31+
[Languages]
32+
Name: "english"; MessagesFile: "compiler:Default.isl"
33+
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
34+
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
35+
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
36+
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
37+
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
38+
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
39+
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
40+
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
41+
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
42+
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
43+
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
44+
Name: "icelandic"; MessagesFile: "compiler:Languages\Icelandic.isl"
45+
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
46+
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
47+
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
48+
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
49+
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
50+
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
51+
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
52+
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
53+
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
54+
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
55+
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
56+
57+
[Tasks]
58+
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
59+
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
60+
61+
[Files]
62+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\deepstack.exe"; DestDir: "{app}"; Flags: ignoreversion
63+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\*"; DestDir: "{app}";
64+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\deepstack\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
65+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\interpreter\*"; DestDir: "{app}\interpreter"; Flags: ignoreversion recursesubdirs createallsubdirs
66+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\redis\*"; DestDir: "{app}\redis"; Flags: ignoreversion recursesubdirs createallsubdirs
67+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\*"; DestDir: "{app}\server"; Flags: ignoreversion recursesubdirs createallsubdirs
68+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\platform\platform.windows.cpu.json"; DestDir: "{app}\server\platform.json"; Flags: ignoreversion
69+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\version.txt"; DestDir: "{app}\server"; Flags: ignoreversion
70+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\categories_places365.txt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
71+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\face.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
72+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\facerec-high.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
73+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\scene.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
74+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\yolov5m.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
75+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\windows_packages_cpu\*"; DestDir: "{app}\windows_packages"; Flags: ignoreversion recursesubdirs createallsubdirs
76+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
77+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
78+
79+
[Icons]
80+
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
81+
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
82+
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: desktopicon quicklaunchicon
83+
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: quicklaunchicon
84+
85+
[Code]
86+
procedure CurStepChanged(CurStep: TSetupStep);
87+
begin
88+
if CurStep = ssPostInstall
89+
then EnvAddPath(ExpandConstant('{app}') + '\server');
90+
end;
91+
92+
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
93+
begin
94+
if CurUninstallStep = usPostUninstall
95+
then EnvRemovePath(ExpandConstant('{app}' + '\server'));
96+
end;

deepstack-setup-gpu.iss

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
; Script generated by the Inno Script Studio Wizard.
2+
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
3+
#include "environment.iss"
4+
#define MyAppName "DeepStack"
5+
#define MyAppVersion "2021.01.beta"
6+
#define MyAppPublisher "DeepQuestAI"
7+
#define MyAppURL "https://www.deepstack.cc"
8+
#define MyAppExeName "deepstack.exe"
9+
#define MyAppIcon "logo.ico"
10+
11+
[Setup]
12+
ChangesEnvironment=true
13+
; NOTE: The value of AppId uniquely identifies this application.
14+
; Do not use the same AppId value in installers for other applications.
15+
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
16+
AppId={{0E2C3125-3440-4622-A82A-3B1E07310EF2}
17+
AppName={#MyAppName}
18+
AppVersion={#MyAppVersion}
19+
;AppVerName={#MyAppName} {#MyAppVersion}
20+
AppPublisher={#MyAppPublisher}
21+
AppPublisherURL={#MyAppURL}
22+
AppSupportURL={#MyAppURL}
23+
AppUpdatesURL={#MyAppURL}
24+
DefaultDirName=C:\{#MyAppName}
25+
DisableDirPage=yes
26+
DefaultGroupName=DeepStack
27+
OutputBaseFilename=DeepStack-Installer-GPU.2021.01.beta
28+
Compression=lzma
29+
SolidCompression=yes
30+
31+
[Languages]
32+
Name: "english"; MessagesFile: "compiler:Default.isl"
33+
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
34+
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
35+
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
36+
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
37+
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
38+
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
39+
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
40+
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
41+
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
42+
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
43+
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
44+
Name: "icelandic"; MessagesFile: "compiler:Languages\Icelandic.isl"
45+
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
46+
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
47+
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
48+
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
49+
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
50+
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
51+
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
52+
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
53+
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
54+
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
55+
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
56+
57+
[Tasks]
58+
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
59+
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
60+
61+
[Files]
62+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\deepstack.exe"; DestDir: "{app}"; Flags: ignoreversion
63+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\*"; DestDir: "{app}";
64+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\deepstack\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
65+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\interpreter\*"; DestDir: "{app}\interpreter"; Flags: ignoreversion recursesubdirs createallsubdirs
66+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\redis\*"; DestDir: "{app}\redis"; Flags: ignoreversion recursesubdirs createallsubdirs
67+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\*"; DestDir: "{app}\server"; Flags: ignoreversion recursesubdirs createallsubdirs
68+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\platform\platform.windows.gpu.json"; DestDir: "{app}\server\platform.json"; Flags: ignoreversion
69+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\version.txt"; DestDir: "{app}\server"; Flags: ignoreversion
70+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\categories_places365.txt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
71+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\face.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
72+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\facerec-high.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
73+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\scene.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
74+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\yolov5m.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
75+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\windows_packages_gpu\*"; DestDir: "{app}\windows_packages"; Flags: ignoreversion recursesubdirs createallsubdirs
76+
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
77+
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
78+
79+
[Icons]
80+
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
81+
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
82+
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: desktopicon quicklaunchicon
83+
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: quicklaunchicon
84+
85+
[Code]
86+
procedure CurStepChanged(CurStep: TSetupStep);
87+
begin
88+
if CurStep = ssPostInstall
89+
then EnvAddPath(ExpandConstant('{app}') + '\server');
90+
end;
91+
92+
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
93+
begin
94+
if CurUninstallStep = usPostUninstall
95+
then EnvRemovePath(ExpandConstant('{app}' + '\server'));
96+
end;

deepstack/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sqlite3
33
from sqlite3 import Cursor, Error
44

5-
DATA_DIR = "/datastore"
5+
DATA_DIR = os.getenv("DATA_DIR", "/datastore")
66

77
CREATE_TABLE = "CREATE TABLE IF NOT EXISTS TB_EMBEDDINGS(userid TEXT PRIMARY KEY, embedding TEXT NOT NULL)"
88
CREATE_TABLE2 = "CREATE TABLE IF NOT EXISTS TB_EMBEDDINGS2(userid TEXT PRIMARY KEY, embedding TEXT NOT NULL)"

deepstack/intelligencelayer/__init__.py

Whitespace-only changes.

deepstack/intelligencelayer/shared/detection.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,23 @@
99
import warnings
1010
from multiprocessing import Process
1111

12+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "."))
13+
14+
from shared import SharedOptions
15+
if SharedOptions.PROFILE == "windows_native":
16+
sys.path.append(os.path.join(SharedOptions.APP_DIR,"windows_packages"))
17+
1218
import numpy as np
1319
import torch
1420
import torch.nn.functional as F
1521
from PIL import Image, UnidentifiedImageError
1622

17-
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../"))
18-
1923
import argparse
2024
import traceback
2125

2226
import torchvision.transforms as transforms
2327
from PIL import UnidentifiedImageError
2428
from process import YOLODetector
25-
from shared import SharedOptions
2629

2730
parser = argparse.ArgumentParser()
2831
parser.add_argument("--model", type=str, default=None)
@@ -79,12 +82,10 @@ def objectdetection(thread_name: str, delay: float):
7982
req_id = req_data["reqid"]
8083
req_type = req_data["reqtype"]
8184
threshold = float(req_data["minconfidence"])
85+
img_path = os.path.join(TEMP_PATH, img_id)
8286

8387
try:
84-
85-
img = os.path.join(TEMP_PATH, img_id)
86-
87-
det = detector.predict(img, threshold)
88+
det = detector.predict(img_path, threshold)
8889

8990
outputs = []
9091

@@ -133,11 +134,11 @@ def objectdetection(thread_name: str, delay: float):
133134

134135
finally:
135136
db.set(req_id, json.dumps(output))
136-
if os.path.exists(TEMP_PATH + img_id):
137-
os.remove(img)
137+
if os.path.exists(img_path):
138+
os.remove(img_path)
138139

139140
time.sleep(delay)
141+
if __name__ == "__main__":
142+
p = Process(target=objectdetection, args=("", SharedOptions.SLEEP_TIME))
143+
p.start()
140144

141-
142-
p = Process(target=objectdetection, args=("", SharedOptions.SLEEP_TIME))
143-
p.start()

0 commit comments

Comments
 (0)