jveitchmichaelis / edgetpu-yolo

Minimal-dependency Yolov5 and Yolov8 export and inference demonstration for the Google Coral EdgeTPU
101 stars 31 forks source link

Docker fails to build on Ubuntu 22.04 #16

Open bryanhughes opened 7 months ago

bryanhughes commented 7 months ago

I have a fresh install of Ubuntu 22.04. When I try to do the docker build as in the instructions I get the following:

$ sudo docker build -t edgetpu .
[+] Building 3.1s (14/15)                                                                                                                                                                                    docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                   0.0s
 => => transferring dockerfile: 716B                                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                        0.8s
 => [internal] load .dockerignore                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                        0.0s
 => [ 1/12] FROM docker.io/library/ubuntu:20.04@sha256:bb1c41682308d7040f74d103022816d41c50d7b0c89e9d706a74b4e548636e54                                                                                                0.0s
 => CACHED [ 2/12] RUN apt-get update && apt-get -y upgrade                                                                                                                                                            0.0s
 => CACHED [ 3/12] RUN apt-get install -y git curl gnupg                                                                                                                                                               0.0s
 => CACHED [ 4/12] RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list                                                                     0.0s
 => CACHED [ 5/12] RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -                                                                                                                      0.0s
 => CACHED [ 6/12] RUN apt-get update && apt-get install -y gasket-dkms libedgetpu1-std python3-pycoral                                                                                                                0.0s
 => CACHED [ 7/12] RUN apt-get install -y python3 python3-pip                                                                                                                                                          0.0s
 => CACHED [ 8/12] RUN pip3 install --upgrade pip setuptools wheel                                                                                                                                                     0.0s
 => CACHED [ 9/12] RUN python3 -m pip install numpy                                                                                                                                                                    0.0s
 => CACHED [10/12] RUN python3 -m pip install opencv-python-headless                                                                                                                                                   0.0s
 => ERROR [11/12] RUN python3 -m pip install tqdm pyyaml json                                                                                                                                                          2.2s
------                                                                                                                                                                                                                      
 > [11/12] RUN python3 -m pip install tqdm pyyaml json:                                                                                                                                                                     
1.031 Collecting tqdm                                                                                                                                                                                                       
1.677   Downloading tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)                                                                                                                                                           
1.855      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.6/57.6 kB 282.0 kB/s eta 0:00:00                                                                                                                                      
1.950 Collecting pyyaml                                                                                                                                                                                                     
1.984   Downloading PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
2.096 ERROR: Could not find a version that satisfies the requirement json (from versions: none)
2.096 ERROR: No matching distribution found for json
------
Dockerfile:16
--------------------
  14 |     RUN python3 -m pip install numpy
  15 |     RUN python3 -m pip install opencv-python-headless
  16 | >>> RUN python3 -m pip install tqdm pyyaml json
  17 |     
  18 |     # Mountpoint for yolo testing
--------------------
ERROR: failed to solve: process "/bin/sh -c python3 -m pip install tqdm pyyaml json" did not complete successfully: exit code: 1
jveitchmichaelis commented 7 months ago

Try removing json from that line in the docker file. It should be part of the standard library, so i’m not sure why it's in there. Your host OS shouldn’t make a difference though.

bryanhughes commented 7 months ago

Thank you! Also, thank you for making your work available. I get docker to build and run, but then throws the following:

root@dd52abc5ae75:/yolo# python3 detect.py -m yolov5s-int8-224_edgetpu.tflite --bench_speed
INFO:EdgeTPUModel:Confidence threshold: 0.25
INFO:EdgeTPUModel:IOU threshold: 0.45
INFO:EdgeTPUModel:Loaded 80 classes
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 160, in load_delegate
    delegate = Delegate(library, options)
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 119, in __init__
    raise ValueError(capture.message)
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "detect.py", line 47, in <module>
    model = EdgeTPUModel(args.model, args.names, conf_thresh=args.conf_thresh, iou_thresh=args.iou_thresh)
  File "/yolo/edgetpumodel.py", line 56, in __init__
    self.make_interpreter()
  File "/yolo/edgetpumodel.py", line 81, in make_interpreter
    self.interpreter = etpu.make_interpreter(self.model_file)
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 87, in make_interpreter
    delegates = [load_edgetpu_delegate({'device': device} if device else {})]
  File "/usr/lib/python3/dist-packages/pycoral/utils/edgetpu.py", line 52, in load_edgetpu_delegate
    return tflite.load_delegate(_EDGETPU_SHARED_LIB, options or {})
  File "/usr/lib/python3/dist-packages/tflite_runtime/interpreter.py", line 162, in load_delegate
    raise ValueError('Failed to load delegate from {}\n{}'.format(
ValueError: Failed to load delegate from libedgetpu.so.1

root@dd52abc5ae75:/yolo# 

I am coming to realize what a piece of garbage this device is and Google's support of it. Sad because it has so much potential.

jveitchmichaelis commented 7 months ago

How are you running Docker? Can you see the device from inside the container? I'd guess this is a permission issue, but not sure.