6 Commits

Author SHA1 Message Date
2f054a19f8 Fix torchvision version
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-25 23:14:14 +01:00
87a389eceb Fix torch version.
Some checks failed
continuous-integration/drone/push Build was killed
2024-03-25 23:13:04 +01:00
9098b7703c Fix Docker without nvidia
Some checks failed
continuous-integration/drone/push Build is failing
2024-03-25 23:06:57 +01:00
0231d0cede Make ultralytics smaller for CPU only 2024-03-25 23:06:04 +01:00
9479b4bd75 Make blurring work (PR #33) 2024-03-25 23:04:36 +01:00
2d83eb997b Drone build
All checks were successful
continuous-integration/drone Build is passing
2024-03-15 14:50:25 +01:00
5 changed files with 39 additions and 4 deletions

16
.drone.yml Normal file
View File

@@ -0,0 +1,16 @@
kind: pipeline
name: default
steps:
- name: docker
image: plugins/docker
settings:
registry: https://git.ivasoft.cz
username:
from_secret: repo_user
password:
from_secret: repo_pass
repo: git.ivasoft.cz/sw/geovisio-sgblur
tags:
- latest
- ${DRONE_TAG:-latest}

View File

@@ -27,7 +27,12 @@ RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
&& rm -rf /var/lib/apt/lists/*
COPY ./requirements.txt ./
RUN pip install -r ./requirements.txt
RUN pip install -r ./requirements.txt && \
# Install torch and torchvision CPU only versions
pip install torch==2.2.1+cpu torchvision==0.17.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html && \
#Explicitly install ultralytics without optional dependencies (like CUDA). (see https://github.com/ultralytics/ultralytics/issues/749)
pip install ultralytics==8.1.19 --no-deps && \
pip cache purge
# Source files
COPY ./src ./src

View File

@@ -1,4 +1,3 @@
ultralytics==8.1.19
pyturbojpeg==1.7.3
Pillow-simd==9.0.0.post1
uuid==1.30
@@ -7,3 +6,15 @@ python-multipart==0.0.9
fastapi==0.110.0
uvicorn==0.27.1
requests==2.31.0
opencv-python-headless==4.8.1.78
numpy==1.26.0
matplotlib>=3.3.0
opencv-python>=4.6.0
pillow>=7.1.2
pyyaml>=5.3.1
scipy>=1.4.1
tqdm>=4.64.0
pandas>=1.1.4
psutil
dill
py-cpuinfo

View File

@@ -1,6 +1,6 @@
from fastapi import FastAPI, UploadFile, Response
import gc
from . import blur
from . import blur_monolith as blur
import json
app = FastAPI()

View File

@@ -36,7 +36,10 @@ def blurPicture(picture, keep):
if 'SGBLUR_GPUS' in os.environ:
gpu = pid % int(os.environ['SGBLUR_GPUS'])
else:
gpu = pid % torch.cuda.device_count()
if torch.cuda.device_count() > 0:
gpu = pid % torch.cuda.device_count()
else:
gpu = None
# copy received JPEG picture to temporary file
tmp = '/dev/shm/blur%s.jpg' % pid