This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from edgetpu.classification.engine import ClassificationEngine | |
from edgetpu.utils import dataset_utils | |
from PIL import Image | |
import multiprocessing | |
from multiprocessing import Process | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Google LLC | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
import cv2 | |
import cv2 as cv | |
import tensorflow as tf | |
from tensorflow.lite.python.interpreter import load_delegate | |
from edgetpu.basic import edgetpu_utils | |
from collections import namedtuple | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Google LLC | |
# | |
# Changes made by Nam Vu 01/20/2020 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.apache.org/licenses/LICENSE-2.0 | |
# Copyright 2019 Google LLC | |
# Modified by Nam Vu | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
r""" Example using tf.compat.v2.lite to classify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Google LLC | |
# | |
# Changes made by Nam Vu 01/20/2020 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) create this dockerfile | |
# 2) build: docker build -t "coral-edgetpu" . | |
# 3) run: docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb coral-edgetpu /bin/bash | |
# 4) download install requriements: cd ~/tflite/python/examples/classification/ && bash install_requirements.sh | |
# 5) run example: python3 classify_image.py \ | |
# > --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \ | |
# > --labels models/inat_bird_labels.txt \ | |
# > --input images/parrot.jpg | |
FROM tensorflow/tensorflow:1.15.0-py3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Google LLC | |
# | |
# Changes made by Nam Vu 02/25/2020 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# https://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1) create this dockerfile | |
# 2) build: docker build -t "coral-edgetpu" . | |
# 3) run: docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb coral-edgetpu /bin/bash | |
# 4) download install requriements: cd ~/tflite/python/examples/classification/ && bash install_requirements.sh | |
# 5) run example: python3 classify_image.py \ | |
# > --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite \ | |
# > --labels models/inat_bird_labels.txt \ | |
# > --input images/parrot.jpg | |
FROM tensorflow/tensorflow:1.15.0-py3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, argparse, cv2, sys, time, numpy | |
from tflite_runtime.interpreter import Interpreter | |
from tflite_runtime.interpreter import load_delegate | |
''' | |
Requirements: | |
1) Install the tflite_runtime package from here: | |
https://www.tensorflow.org/lite/guide/python | |
2) Camera to take inputs | |
3) Install libedgetpu |
OlderNewer