In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to deploy YOLOv3-tiny on VS2015 using Openvino? this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Preface
A few days ago, I added two Openvino groups to ask about how Openvino did the int8 quantization of YOLOv3-tiny, but I didn't get the answer I wanted. But found that there are so many people Openvino is not good, are looking for information on the network, I Baidu Chinese does not seem to be reliable target detection algorithm deployment information, in fact, this is not difficult, with the official example can be changed. So I promised several students to write a deployment process in the hope that it is possible to use Openvino to deploy YOLOv3-tiny (other target detection algorithms and so on) to cpu or Intel neural rods (first or second generation).
YOLOv3-tiny model training
I will not introduce too much in this part. I use the YOLOv3-tiny model trained by the AlexeyAB version of darknet (see appendix), get the desired weights file, and call the command to test the detection effect of the image.
Darknet model to pb model clone OpenVINO-YoloV3 project, the full address is shown in the appendix. Modify the coco.names under the project to be the same as when you train. Make sure that the python environment you are using has a tensorflow version. 1.8and 1.9should be fine. Execute: python3 convert_weights_pb.py
-- class_names voc.names
-- weights_file yolov3_tiny_200000.weights
-- data_format NHWC
-tiny-output_graph frozen_tiny_yolo_v3.pb
Not surprisingly, the frozen_tiny_yolo_v3.pb file will be generated under your OpenVINO-YoloV3 file, which is the pb file we need. Convert pb file to IR model on Windows
I use OpenVINO2019.1.087 here, as long as the extension module in a certain version of OpenVINO contains YOLORegion Layer, it should be OK. The conversion steps are as follows:
Copy frozen_tiny_yolo_v3.pb to the F:\ IntelSWTools\ openvino_2019.1.087\ deployment_tools\ model_optimizer folder where OpenVINO is located. Note that this folder is the path where I installed OpenVINO. Modify it yourself. Create a new yolov3-tiny.json file and put it in the F:\ IntelSWTools\ openvino_2019.1.087\ deployment_tools\ model_optimizer folder. The content is, note that classes is the number of target categories in your dataset: [
{
"id": "TFYOLOV3"
"match_kind": "general"
"custom_attributes": {
"classes": 3
"coords": 4
"num": 6
"mask": [0je 1jue 2]
"anchors": [10, 14, 23, 27, 37, 58, 81, 82135169344319]
"entry_points": ["detector/yolo-v3-tiny/Reshape", "detector/yolo-v3-tiny/Reshape_4"]
}
}
]
Under the F:\ IntelSWTools\ openvino_2019.1.087\ deployment_tools\ model_optimizer folder, execute the following command to complete the IR file conversion process from pb file to OpenVINO. Python mo_tf.py-input_model frozen_darknet_yolov3_model.pb
-- tensorflow_use_custom_operations_config yolo_v3_tiny.json
-- input_shape= [1, 416, 4, 16, 3]-- data_type=FP32
If nothing happens, you can get frozen_darknet_yolov3_model.bin and frozen_darknet_yolov3_model.xml. Using VS2015 and OpenVINO to complete the forward reasoning of YOLOv3-tiny
Because the yoloRegion Layer layer in yolov3-tiny is the extension layer of openvino, you need to add the cpu_extension.lib and extension folders when vs2015 configures the lib and include folders. Finally, the files in the include and lib folders are as follows:
Include folder: lib folder:
Cpu_extension.lib may not be available after installing OpenVINO, so you need to compile it manually. The process is very simple. I put a link at the back to make it very clear.
Once include and lib are configured, you can write code to predict. The code only needs to be modified slightly in the main.cpp provided in the cpp directory of the OpenVINO-YoloV3 project. Because I am not using the original Darknet here, but the AlexeyAB version of darknet, so the image resize to 416 is a direct resize rather than letter box. Specifically, the code for the modified part is: then, in addition to this place, since the cpp in the YOLOv3-tiny,OpenVINO-YoloV3 used uses YOLOv3's Anchor by default, the Anchor is also modified accordingly:
After changing these two places, you can successfully complete the forward reasoning process, after my test, compared with the original darknet test results in the decimal point after the two places began to show a gap, from my test results in thousands of pictures, the accuracy difference in 1max 1000 to 1max 500, is completely acceptable.
Note that the cpp on the github is unnecessary to comment out, and then the asynchronous strategy can also choose not to be used during the test. I modified a cpp that can be run directly.
This is the answer to the question about how to deploy YOLOv3-tiny on VS2015 using Openvino. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.