Commit
β’
d4ea61e
1
Parent(s):
e305aba
FROM nvcr.io/nvidia/pytorch:22.04-py3 (#7680)
Browse files* FROM nvcr.io/nvidia/pytorch:22.04-py3
* Update Docker
* Update Docker
* Update Docker
* Update Docker
* Update TRT auto-install
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Cleanup
* Cleanup
* Cleanup cpu
* Cleanup cpu
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- export.py +6 -3
- utils/docker/Dockerfile +9 -8
- utils/docker/Dockerfile-cpu +3 -3
export.py
CHANGED
@@ -218,9 +218,12 @@ def export_engine(model, im, file, train, half, simplify, workspace=4, verbose=F
|
|
218 |
# YOLOv5 TensorRT export https://developer.nvidia.com/tensorrt
|
219 |
try:
|
220 |
assert im.device.type != 'cpu', 'export running on CPU but must be on GPU, i.e. `python export.py --device 0`'
|
221 |
-
|
222 |
-
|
223 |
-
|
|
|
|
|
|
|
224 |
|
225 |
if trt.__version__[0] == '7': # TensorRT 7 handling https://github.com/ultralytics/yolov5/issues/6012
|
226 |
grid = model.model[-1].anchor_grid
|
|
|
218 |
# YOLOv5 TensorRT export https://developer.nvidia.com/tensorrt
|
219 |
try:
|
220 |
assert im.device.type != 'cpu', 'export running on CPU but must be on GPU, i.e. `python export.py --device 0`'
|
221 |
+
try:
|
222 |
+
import tensorrt as trt
|
223 |
+
except Exception:
|
224 |
+
if platform.system() == 'Linux':
|
225 |
+
check_requirements(('nvidia-tensorrt',), cmds=('-U --index-url https://pypi.ngc.nvidia.com',))
|
226 |
+
import tensorrt as trt
|
227 |
|
228 |
if trt.__version__[0] == '7': # TensorRT 7 handling https://github.com/ultralytics/yolov5/issues/6012
|
229 |
grid = model.model[-1].anchor_grid
|
utils/docker/Dockerfile
CHANGED
@@ -1,7 +1,11 @@
|
|
1 |
# YOLOv5 π by Ultralytics, GPL-3.0 license
|
2 |
|
3 |
-
# Start FROM
|
4 |
-
FROM nvcr.io/nvidia/pytorch:
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# Install linux packages
|
7 |
RUN apt update && apt install -y zip htop screen libgl1-mesa-glx
|
@@ -9,9 +13,9 @@ RUN apt update && apt install -y zip htop screen libgl1-mesa-glx
|
|
9 |
# Install pip packages
|
10 |
COPY requirements.txt .
|
11 |
RUN python -m pip install --upgrade pip
|
12 |
-
RUN pip uninstall -y torch torchvision torchtext
|
13 |
-
RUN pip install --no-cache -r requirements.txt albumentations wandb gsutil notebook \
|
14 |
-
torch
|
15 |
|
16 |
# Create working directory
|
17 |
RUN mkdir -p /usr/src/app
|
@@ -21,9 +25,6 @@ WORKDIR /usr/src/app
|
|
21 |
COPY . /usr/src/app
|
22 |
RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
|
23 |
|
24 |
-
# Downloads to user config dir
|
25 |
-
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
|
26 |
-
|
27 |
# Set environment variables
|
28 |
ENV OMP_NUM_THREADS=8
|
29 |
|
|
|
1 |
# YOLOv5 π by Ultralytics, GPL-3.0 license
|
2 |
|
3 |
+
# Start FROM NVIDIA PyTorch image https://ngc.nvidia.com/catalog/containers/nvidia:pytorch
|
4 |
+
FROM nvcr.io/nvidia/pytorch:22.04-py3
|
5 |
+
RUN rm -rf /opt/pytorch # remove 1.2GB dir
|
6 |
+
|
7 |
+
# Downloads to user config dir
|
8 |
+
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
|
9 |
|
10 |
# Install linux packages
|
11 |
RUN apt update && apt install -y zip htop screen libgl1-mesa-glx
|
|
|
13 |
# Install pip packages
|
14 |
COPY requirements.txt .
|
15 |
RUN python -m pip install --upgrade pip
|
16 |
+
RUN pip uninstall -y torch torchvision torchtext Pillow
|
17 |
+
RUN pip install --no-cache -r requirements.txt albumentations wandb gsutil notebook Pillow>=9.1.0 \
|
18 |
+
torch torchvision --extra-index-url https://download.pytorch.org/whl/cu113
|
19 |
|
20 |
# Create working directory
|
21 |
RUN mkdir -p /usr/src/app
|
|
|
25 |
COPY . /usr/src/app
|
26 |
RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
|
27 |
|
|
|
|
|
|
|
28 |
# Set environment variables
|
29 |
ENV OMP_NUM_THREADS=8
|
30 |
|
utils/docker/Dockerfile-cpu
CHANGED
@@ -3,6 +3,9 @@
|
|
3 |
# Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
|
4 |
FROM ubuntu:20.04
|
5 |
|
|
|
|
|
|
|
6 |
# Install linux packages
|
7 |
RUN apt update
|
8 |
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y tzdata
|
@@ -24,9 +27,6 @@ WORKDIR /usr/src/app
|
|
24 |
COPY . /usr/src/app
|
25 |
RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
|
26 |
|
27 |
-
# Downloads to user config dir
|
28 |
-
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
|
29 |
-
|
30 |
|
31 |
# Usage Examples -------------------------------------------------------------------------------------------------------
|
32 |
|
|
|
3 |
# Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
|
4 |
FROM ubuntu:20.04
|
5 |
|
6 |
+
# Downloads to user config dir
|
7 |
+
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
|
8 |
+
|
9 |
# Install linux packages
|
10 |
RUN apt update
|
11 |
RUN DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt install -y tzdata
|
|
|
27 |
COPY . /usr/src/app
|
28 |
RUN git clone https://github.com/ultralytics/yolov5 /usr/src/yolov5
|
29 |
|
|
|
|
|
|
|
30 |
|
31 |
# Usage Examples -------------------------------------------------------------------------------------------------------
|
32 |
|