Skip to content

Instantly share code, notes, and snippets.

@Namburger
Last active October 21, 2022 12:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Namburger/5c18a894951cb4bf26d6033b029e4144 to your computer and use it in GitHub Desktop.
Save Namburger/5c18a894951cb4bf26d6033b029e4144 to your computer and use it in GitHub Desktop.
ubuntu18.04 coral minimal example
FROM ubuntu:18.04
WORKDIR /home
ENV HOME /home
RUN cd ~
RUN apt-get update
RUN apt-get install -y git nano python3-pip python-dev pkg-config wget usbutils curl
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" \
| tee /etc/apt/sources.list.d/coral-edgetpu.list
RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
RUN apt-get update
RUN git clone https://github.com/google-coral/pycoral.git
RUN git clone https://github.com/google-coral/test_data.git
RUN apt install -y python3-pycoral
@Namburger
Copy link
Author

  1. Create Dockerfile with above content

  2. Build docker image:

➜  docker build -t "coral-ubuntu18.04" .                  
  1. Run the image with provileged flag for usb access:
➜  docker run -it --privileged coral-ubuntu18.04 /bin/bash
  1. Run the pycoral example:
root@5fff7e4795ee:~# python3 pycoral/examples/detect_image.py -m test_data/ssd_mobilenet_v1_coco_quant_postprocess_edgetpu.tflite -l test_data/coco_labels.txt -i test_data/grace_hopper.bmp 
----INFERENCE TIME----
Note: The first inference is slow because it includes loading the model into Edge TPU memory.
37.37 ms
20.69 ms
20.36 ms
20.38 ms
20.66 ms
-------RESULTS--------
person
  id:     0
  score:  0.703125
  bbox:   BBox(xmin=4, ymin=8, xmax=529, ymax=601)
tie
  id:     31
  score:  0.5
  bbox:   BBox(xmin=222, ymin=410, xmax=293, ymax=552)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment