Skip to content

Commit

Permalink
Merge pull request #60 from johnolafenwa/johnolafenwa/windows
Browse files Browse the repository at this point in the history
Johnolafenwa/windows
  • Loading branch information
johnolafenwa authored Jan 6, 2021
2 parents 93185cc + d40a118 commit caea44b
Show file tree
Hide file tree
Showing 9,200 changed files with 3,925,974 additions and 122 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ __pycache__/
# C extensions
*.so

*.exe
!windows_packages/*.exe
!redis/*.exe
!interpreter/*.exe

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
logs
eggs/
.eggs/
lib/
Expand All @@ -26,7 +32,6 @@ share/python-wheels/
*.egg
MANIFEST
server/server

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
Expand Down
96 changes: 96 additions & 0 deletions deepstack-setup-cpu.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#include "environment.iss"
#define MyAppName "DeepStack"
#define MyAppVersion "2021.01.beta"
#define MyAppPublisher "DeepQuestAI"
#define MyAppURL "https://www.deepstack.cc"
#define MyAppExeName "deepstack.exe"
#define MyAppIcon "logo.ico"

[Setup]
ChangesEnvironment=true
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{0E2C3125-3440-4622-A82A-3B1E07310EF2}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName=C:\{#MyAppName}
DisableDirPage=yes
DefaultGroupName=DeepStack
OutputBaseFilename=DeepStack-Installer-CPU.2021.01.beta
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: "icelandic"; MessagesFile: "compiler:Languages\Icelandic.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\deepstack.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\*"; DestDir: "{app}";
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\deepstack\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\interpreter\*"; DestDir: "{app}\interpreter"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\redis\*"; DestDir: "{app}\redis"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\*"; DestDir: "{app}\server"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\platform\platform.windows.cpu.json"; DestDir: "{app}\server\platform.json"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\version.txt"; DestDir: "{app}\server"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\categories_places365.txt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\face.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\facerec-high.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\scene.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\yolov5m.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\windows_packages_cpu\*"; DestDir: "{app}\windows_packages"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: desktopicon quicklaunchicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: quicklaunchicon

[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall
then EnvAddPath(ExpandConstant('{app}') + '\server');
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall
then EnvRemovePath(ExpandConstant('{app}' + '\server'));
end;
96 changes: 96 additions & 0 deletions deepstack-setup-gpu.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#include "environment.iss"
#define MyAppName "DeepStack"
#define MyAppVersion "2021.01.beta"
#define MyAppPublisher "DeepQuestAI"
#define MyAppURL "https://www.deepstack.cc"
#define MyAppExeName "deepstack.exe"
#define MyAppIcon "logo.ico"

[Setup]
ChangesEnvironment=true
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{0E2C3125-3440-4622-A82A-3B1E07310EF2}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName=C:\{#MyAppName}
DisableDirPage=yes
DefaultGroupName=DeepStack
OutputBaseFilename=DeepStack-Installer-GPU.2021.01.beta
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "german"; MessagesFile: "compiler:Languages\German.isl"
Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: "icelandic"; MessagesFile: "compiler:Languages\Icelandic.isl"
Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1

[Files]
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\deepstack.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\*"; DestDir: "{app}";
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\deepstack\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\interpreter\*"; DestDir: "{app}\interpreter"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\redis\*"; DestDir: "{app}\redis"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\*"; DestDir: "{app}\server"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\platform\platform.windows.gpu.json"; DestDir: "{app}\server\platform.json"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\server\version.txt"; DestDir: "{app}\server"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\categories_places365.txt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\face.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\facerec-high.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\scene.model"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\sharedfiles\yolov5m.pt"; DestDir: "{app}\sharedfiles"; Flags: ignoreversion
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\windows_packages_gpu\*"; DestDir: "{app}\windows_packages"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\johnolafenwa\Documents\AI\DeepStack\logo.ico"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: desktopicon quicklaunchicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; IconFilename: {app}\{#MyAppIcon}; Tasks: quicklaunchicon

[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall
then EnvAddPath(ExpandConstant('{app}') + '\server');
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall
then EnvRemovePath(ExpandConstant('{app}' + '\server'));
end;
2 changes: 1 addition & 1 deletion deepstack/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sqlite3
from sqlite3 import Cursor, Error

DATA_DIR = "/datastore"
DATA_DIR = os.getenv("DATA_DIR", "/datastore")

CREATE_TABLE = "CREATE TABLE IF NOT EXISTS TB_EMBEDDINGS(userid TEXT PRIMARY KEY, embedding TEXT NOT NULL)"
CREATE_TABLE2 = "CREATE TABLE IF NOT EXISTS TB_EMBEDDINGS2(userid TEXT PRIMARY KEY, embedding TEXT NOT NULL)"
Expand Down
Empty file.
25 changes: 13 additions & 12 deletions deepstack/intelligencelayer/shared/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@
import warnings
from multiprocessing import Process

sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "."))

from shared import SharedOptions
if SharedOptions.PROFILE == "windows_native":
sys.path.append(os.path.join(SharedOptions.APP_DIR,"windows_packages"))

import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image, UnidentifiedImageError

sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../"))

import argparse
import traceback

import torchvision.transforms as transforms
from PIL import UnidentifiedImageError
from process import YOLODetector
from shared import SharedOptions

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

try:

img = os.path.join(TEMP_PATH, img_id)

det = detector.predict(img, threshold)
det = detector.predict(img_path, threshold)

outputs = []

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

finally:
db.set(req_id, json.dumps(output))
if os.path.exists(TEMP_PATH + img_id):
os.remove(img)
if os.path.exists(img_path):
os.remove(img_path)

time.sleep(delay)
if __name__ == "__main__":
p = Process(target=objectdetection, args=("", SharedOptions.SLEEP_TIME))
p.start()


p = Process(target=objectdetection, args=("", SharedOptions.SLEEP_TIME))
p.start()
Loading

0 comments on commit caea44b

Please sign in to comment.