Make ultralytics smaller for CPU only

This commit is contained in:
2024-03-25 23:06:04 +01:00
parent 9479b4bd75
commit 0231d0cede
2 changed files with 19 additions and 2 deletions

View File

@@ -27,7 +27,13 @@ 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==1.8.0+cpu torchvision==0.9.0+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 && \
rm -rf /usr/local/lib/python3.10/site-packages/nvidia
# 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