To dump TensorFlow model out of https://github.com/mystic123/tensorflow-yolo-v3 GitHub repository (commit ed60b90), follow the instructions below:
- Clone the repository:
- (Optional) Checkout to the commit that the conversion was tested on:
- Download coco.names file from the DarkNet website OR use labels that fit your task.
- Download the yolov3.weights (for the YOLOv3 model) or yolov3-tiny.weights (for the YOLOv3-tiny model) file OR use your pretrained weights with the same structure
- Run a converter:
- for YOLO-v3:
- for YOLOv3-tiny:
If you have YOLOv3 weights trained for an input image with the size different from 416 (320, 608 or your own), please provide the
--size key with the size of your image specified while running the converter. For example, run the following command for an image with size 608:
To solve the problems explained in the YOLOv3 architecture overview section, use the
yolo_v3_tiny.json (depending on a model) configuration file with custom operations located in the <OPENVINO_INSTALL_DIR>/deployment_tools/model_optimizer/extensions/front/tf repository.
It consists of several attributes:
match_kindare parameters that you cannot change.
custom_attributesis a parameter that stores all the YOLOv3 specific attributes:
masksare attributes that you should copy from the configuration file file that was used for model training. If you used DarkNet officially shared weights, you can use
yolov3-tiny.cfgconfiguration file from https://github.com/pjreddie/darknet/tree/master/cfg. Replace the default values in
custom_attributeswith the parameters that follow the
[yolo]titles in the configuration file.
anchorsis an optional parameter that is not used while inference of the model, but it used in a demo to parse
entry_pointsis a node name list to cut off the model and append the Region layer with custom attributes specified above.
To generate the IR of the YOLOv3 TensorFlow model, run:
To generate the IR of the YOLOv3-tiny TensorFlow model, run:
--batch defines shape of model input. In the example, --batch is equal to 1, but you can also specify other integers larger than 1.
--tensorflow_use_custom_operations_config adds missing Region layers to the model. In the IR, the Region layer has name RegionYolo.