一些小代码片段,展示如何将摄像头图像流式传输到 Coral 设备。
This repo contains a collection of examples that use camera streams together with the TensorFlow Lite API with a Coral device such as the USB Accelerator or Dev Board.
First, be sure you have completed the setup instructions for your Coral device. If it's been a while, repeat to be sure you have the latest software.
Importantly, you should have the latest TensorFlow Lite runtime installed (as per the Python quickstart)).
Clone this Git repo onto your computer:
mkdir google-coral && cd google-coral
git clone https://github.com/google-coral/examples-camera.git --depth 1Download the models:
cd examples-camera
sh download_models.shThese canned models will be downloaded and extracted to a new folder
all_models.
Further requirements may be needed by the different camera libraries, check the README file for the respective subfolder.
install_requirements.sh to make sure all the dependencies are
present.install_requirements.sh to make sure all the dependencies are
present.install_requirements.sh to make sure all the dependencies are
present.For all the demos in this repository you can change the model and the labels
file by using the flags flags --model and
--labels. Be sure to use the models labeled _edgetpu, as those are
compiled for the accelerator - otherwise the model will run on the CPU and
be much slower.
For classification you need to select one of the classification models and its corresponding labels file:
inception_v1_224_quant_edgetpu.tflite, imagenet_labels.txt
inception_v2_224_quant_edgetpu.tflite, imagenet_labels.txt
inception_v3_299_quant_edgetpu.tflite, imagenet_labels.txt
inception_v4_299_quant_edgetpu.tflite, imagenet_labels.txt
mobilenet_v1_1.0_224_quant_edgetpu.tflite, imagenet_labels.txt
mobilenet_v2_1.0_224_quant_edgetpu.tflite, imagenet_labels.txt
mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite, inat_bird_labels.txt
mobilenet_v2_1.0_224_inat_insect_quant_edgetpu.tflite, inat_insect_labels.txt
mobilenet_v2_1.0_224_inat_plant_quant_edgetpu.tflite, inat_plant_labels.txtFor detection you need to select one of the SSD detection models and its corresponding labels file:
mobilenet_ssd_v1_coco_quant_postprocess_edgetpu.tflite, coco_labels.txt
mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite, coco_labels.txt
mobilenet_ssd_v2_face_quant_postprocess_edgetpu.tflite, coco_labels.txt暂无开放 Issues,或尚未同步最近议题。