Skip to content

Commit 8648e71

Browse files
committed
added serve app
1 parent a899015 commit 8648e71

20 files changed

+1323
-5
lines changed

.devcontainer/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM supervisely/base-py-sdk:6.73.251
2+
3+
RUN pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
4+
5+
RUN pip3 install setuptools==69.5.1
6+
RUN pip3 install imagecorruptions==1.1.2
7+
RUN pip3 install ffmpeg-python==0.2.0
8+
RUN pip3 install protobuf==3.20.3
9+
10+
RUN pip3 install detectron2 -f \
11+
https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html
12+
13+
RUN apt-get -y install nvidia-cuda-dev
14+
RUN pip3 install pycuda==2025.1.1
15+
RUN pip3 install nvidia-tensorrt==99.0.0
16+
17+
RUN apt-get update && apt-get -y install wget
18+
RUN apt-get -y install curl
19+
RUN apt-get update && apt -y install wireguard iproute2
20+
21+
RUN pip3 install Pillow==9.5.0
22+
RUN pip3 install timm==1.0.16
23+
RUN pip3 install gdown==5.2.0
24+
RUN pip3 install onnxruntime-gpu==1.11.0
25+
26+
LABEL "role"="development"

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "SparseInstDevContainer",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"ms-python.python",
10+
"ms-python.black-formatter"
11+
]
12+
}
13+
},
14+
"runArgs": [
15+
"--gpus",
16+
"all",
17+
"--ipc=host",
18+
"--cap-add",
19+
"NET_ADMIN",
20+
"--runtime=nvidia"
21+
]
22+
}

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ inference_test_output
66

77

88
*.png
9-
*.json
109
*.diff
1110

1211
# compilation and distribution
@@ -37,7 +36,6 @@ wheels/
3736

3837
# editor settings
3938
.idea
40-
.vscode
4139
_darcs
4240

4341
# project dirs
@@ -48,4 +46,8 @@ _darcs
4846
/models
4947

5048
# mac file
51-
.DS_Store
49+
.DS_Store
50+
51+
images/
52+
supervisely.env
53+
local.env

.vscode/launch.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Uvicorn Serve",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"module": "uvicorn",
9+
"args": [
10+
"main:model.app",
11+
"--host",
12+
"0.0.0.0",
13+
"--port",
14+
"8000",
15+
"--ws",
16+
"websockets",
17+
"--app-dir",
18+
"serve/src"
19+
],
20+
"justMyCode": false,
21+
"env": {
22+
"PYTHONPATH": "${workspaceFolder}:${PYTHONPATH}",
23+
"LOG_LEVEL": "DEBUG",
24+
"DEBUG_APP_DIR": "app_data",
25+
"DEBUG_WITH_SLY_NET": "1",
26+
"APP_NAME": "Serve SparseInst"
27+
}
28+
},
29+
]
30+
}

docker/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM supervisely/base-py-sdk:6.73.251
2+
3+
RUN pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
4+
5+
RUN pip3 install setuptools==69.5.1
6+
RUN pip3 install imagecorruptions==1.1.2
7+
RUN pip3 install ffmpeg-python==0.2.0
8+
RUN pip3 install protobuf==3.20.3
9+
10+
RUN pip3 install detectron2 -f \
11+
https://dl.fbaipublicfiles.com/detectron2/wheels/cu113/torch1.10/index.html
12+
13+
RUN apt-get -y install nvidia-cuda-dev
14+
RUN pip3 install pycuda==2025.1.1
15+
RUN pip3 install nvidia-tensorrt==99.0.0
16+
17+
RUN pip3 install Pillow==9.5.0
18+
RUN pip3 install timm==1.0.16
19+
RUN pip3 install onnxruntime-gpu==1.11.0
20+
21+
RUN apt-get -y install curl
22+
23+
RUN mkdir -p /weights
24+
25+
RUN curl -L -o /weights/sparse_inst_r50_giam_ceaffc.pth "https://github.com/supervisely-ecosystem/SparseInsr/releases/download/v0.0.1/sparse_inst_r50_giam_ceaffc.pth"
26+
RUN curl -L -o /weights/sparse_inst_r50vd_base.pth "https://github.com/supervisely-ecosystem/SparseInsr/releases/download/v0.0.1/sparse_inst_r50vd_base.pth"
27+
RUN curl -L -o /weights/sparse_inst_r50_dcn_giam_aug.pth "https://github.com/supervisely-ecosystem/SparseInsr/releases/download/v0.0.1/sparse_inst_r50_dcn_giam_aug.pth"
28+
RUN curl -L -o /weights/sparse_inst_r50vd_dcn_giam_aug.pth "https://github.com/supervisely-ecosystem/SparseInsr/releases/download/v0.0.1/sparse_inst_r50vd_dcn_giam_aug.pth"
29+
RUN curl -L -o /weights/sparse_inst_pvt_v2_b2_li_giam.pth "https://github.com/supervisely-ecosystem/SparseInsr/releases/download/v0.0.1/sparse_inst_pvt_v2_b2_li_giam.pth"
30+
31+
LABEL python_sdk_version=6.73.251

docker/publish.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
docker build -t supervisely/sparseinst:1.0.1 . && \
2+
docker push supervisely/sparseinst:1.0.1

serve/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Serve SparseInst

serve/config.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "Serve SparseInst",
3+
"type": "app",
4+
"version": "2.0.0",
5+
"description": "Deploy SparseInst as a REST API service",
6+
"categories": [
7+
"neural network",
8+
"images",
9+
"instance segmentation",
10+
"serve"
11+
],
12+
"gpu": "required",
13+
"session_tags": [
14+
"deployed_nn"
15+
],
16+
"community_agent": false,
17+
"docker_image": "supervisely/sparseinst:1.0.1",
18+
"instance_version": "6.12.12",
19+
"entrypoint": "python3 -m uvicorn src.main:m.app --app-dir ./serve --host 0.0.0.0 --port 8000 --ws websockets",
20+
"port": 8000,
21+
"task_location": "application_sessions",
22+
"license": {
23+
"type": "MIT"
24+
},
25+
"access_restriction": [
26+
{
27+
"instance": "community_free",
28+
"message": "The best interactive models for AI-assisted segmentation are already deployed in the Supervisely Cloud and are available for auto-labeling to all platform users. The number of API calls and the ability to run this app on your own agent (GPU) are limited for Free accounts. To increase usage limits or run the app on your GPU, switch to the <a href=\"/billing\">Pro</a> plan or request the <a href=\"https://supervisely.com/contact-us/\" target=\"_blank\">Enterprise</a> Edition."
29+
}
30+
]
31+
}

serve/src/app_options.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pretrained_models: true
2+
custom_models: false
3+
supported_runtimes: ["pytorch", "onnxruntime", "tensorrt"]

serve/src/inference_settings.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
confidence_threshold: 0.5
2+
fp16: false

0 commit comments

Comments
 (0)