From 3f30241a621021c99cdb84b077069636662f76fe Mon Sep 17 00:00:00 2001 From: Tom Allsop Date: Thu, 3 Dec 2020 14:29:20 +0000 Subject: [PATCH] Added YOLO v3 Tiny --- .gitignore | 3 +- MODEL_LIST.md | 1 + .../yolo_v3_tiny/tflite_fp32/README.md | 33 +++++++++++++++++ .../tflite_fp32/recreate_model/README.md | 9 +++++ .../recreate_model/recreate_model.sh | 37 +++++++++++++++++++ .../recreate_model/requirements.txt | 19 ++++++++++ .../yolo_v3_tiny_darknet_fp32.tflite | 3 ++ 7 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 models/object_detection/yolo_v3_tiny/tflite_fp32/README.md create mode 100644 models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/README.md create mode 100755 models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/recreate_model.sh create mode 100644 models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/requirements.txt create mode 100644 models/object_detection/yolo_v3_tiny/tflite_fp32/yolo_v3_tiny_darknet_fp32.tflite diff --git a/.gitignore b/.gitignore index b7ff13a..3909b5d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.DS_STORE \ No newline at end of file +.DS_STORE +.vscode \ No newline at end of file diff --git a/MODEL_LIST.md b/MODEL_LIST.md index 585d069..1ee1fb2 100644 --- a/MODEL_LIST.md +++ b/MODEL_LIST.md @@ -22,3 +22,4 @@ |-----------------|---------|--------------| | [SSD MobileNet v1 FP32](models/object_detection/ssd_mobilenet_v1/tflite_fp32) | FP32 | TensorFlow Lite | | [SSD MobileNet v1 UINT8](models/object_detection/ssd_mobilenet_v1/tflite_uint8) | UINT8 | TensorFlow Lite | +| [YOLO v3 Tiny FP32](models/object_detection/yolo_v3_tiny/tflite_fp32) | FP32 | TensorFlow Lite | diff --git a/models/object_detection/yolo_v3_tiny/tflite_fp32/README.md b/models/object_detection/yolo_v3_tiny/tflite_fp32/README.md new file mode 100644 index 0000000..c8e3156 --- /dev/null +++ b/models/object_detection/yolo_v3_tiny/tflite_fp32/README.md @@ -0,0 +1,33 @@ +# YOLO v3 Tiny FP32 + +## Description +Yolo v3 Tiny is a object detection network, that localizes and identifies objects in an input image. This is a floating point version that takes a 416x416 input image and outputs detections for this image. This model is generated using the weights from the [https://pjreddie.com/darknet/yolo/](YOLO website). + +## License +[Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) + +## Network Information +| Network Information | Value | +|---------------------|------------------| +| Framework | TensorFlow Lite | +| SHA-1 Hash | b38f7be6856eed4466493bdc86be1879f4b743fb | +| Size (Bytes) | 35455980 | +| Provenance | https://pjreddie.com/media/files/yolov3-tiny.weights & https://github.com/mystic123/tensorflow-yolo-v3 | +| Paper | https://arxiv.org/abs/1804.02767 | + +## Accuracy +Dataset: MS COCO Validation + +| Metric | Value | +|--------|-------| +| mAP | 0.331 | + +## Network Inputs +| Input Node Name | Shape | Description | +|-----------------|---------|-------------| +| inputs | (1, 416, 416, 3) | A 416x416 floating point input image. | + +## Network Outputs +| Output Node Name | Shape | Description | +|------------------|---------|-------------| +| output_boxes | (1, 2535, 85) | A 1xNx85 map of predictions, where the first 4 entries of the 3rd dimension are the bounding box coordinates and the 5th is the confidence. The remaining entries are softmax scores for each class. | diff --git a/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/README.md b/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/README.md new file mode 100644 index 0000000..e831aee --- /dev/null +++ b/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/README.md @@ -0,0 +1,9 @@ +# YOLO v3 Tiny FP32 Model Re-Creation +This folder contains a script that allows for the model to be re-created from scratch. + +## Requirements +The script in this folder requires that the following must be installed: +- Python 3.6 + +## Running The Script +To run the script, run the following in a terminal: `./recreate_model.sh` \ No newline at end of file diff --git a/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/recreate_model.sh b/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/recreate_model.sh new file mode 100755 index 0000000..a3e400f --- /dev/null +++ b/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/recreate_model.sh @@ -0,0 +1,37 @@ +# Copyright (C) 2020 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: Apache-2.0 +# +# 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 +# +# 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, 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. + +#!/usr/bin/env bash + +python3.6 -m venv venv +source venv/bin/activate + +pip install -r requirements.txt + +git clone https://github.com/mystic123/tensorflow-yolo-v3 +pushd tensorflow-yolo-v3 + +wget https://raw.githubusercontent.com/pjreddie/darknet/master/data/coco.names +wget https://pjreddie.com/media/files/yolov3-tiny.weights + +python convert_weights_pb.py --class_names coco.names --weights_file yolov3-tiny.weights --data_format NHWC --tiny + +pip install tensorflow==1.15.0 + +tflite_convert --graph_def_file=frozen_darknet_yolov3_model.pb --output_file=yolo_v3_tiny_darknet_fp32.tflite --input_shapes=1,416,416,3 --input_arrays=inputs --output_arrays=output_boxes +mv yolo_v3_tiny_darknet_fp32.tflite .. + +popd \ No newline at end of file diff --git a/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/requirements.txt b/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/requirements.txt new file mode 100644 index 0000000..b3cb92f --- /dev/null +++ b/models/object_detection/yolo_v3_tiny/tflite_fp32/recreate_model/requirements.txt @@ -0,0 +1,19 @@ +absl-py==0.11.0 +astor==0.8.1 +cached-property==1.5.2 +gast==0.4.0 +grpcio==1.33.2 +h5py==3.1.0 +importlib-metadata==2.0.0 +Keras-Applications==1.0.8 +Keras-Preprocessing==1.1.2 +Markdown==3.3.3 +numpy==1.19.4 +Pillow==8.0.1 +protobuf==3.14.0 +six==1.15.0 +tensorboard==1.11.0 +tensorflow==1.11.0 +termcolor==1.1.0 +Werkzeug==1.0.1 +zipp==3.4.0 diff --git a/models/object_detection/yolo_v3_tiny/tflite_fp32/yolo_v3_tiny_darknet_fp32.tflite b/models/object_detection/yolo_v3_tiny/tflite_fp32/yolo_v3_tiny_darknet_fp32.tflite new file mode 100644 index 0000000..c83ef8e --- /dev/null +++ b/models/object_detection/yolo_v3_tiny/tflite_fp32/yolo_v3_tiny_darknet_fp32.tflite @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e247d90cbd4fd682b7ed4b8b4d5a905361e9c8c285825f52b41e10bc012f8cd6 +size 35455980