- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone,
I succeded in training a YoloV3 model with my own dataset, to detect only one class of object. It properly works and do pretty great on the ./darknet detect images, but now I'd like to make it run on the NCS2, to detect on live camera. I already succeeded in making the official yolov3.weights to run on it, by converting it with https://github.com/mystic123/tensorflow-yolo-v3 's ./convert_weights_pb.py, and the openvino model optimizer, but when I try to use it with my own final.weights I get the error :
File "C:\Users\VIDOC\Desktop\tensorflow-yolo-v3-master\utils.py", line 115, in load_weights
(shape[3], shape[2], shape[0], shape[1]))
ValueError: cannot reshape array of size 283154 into shape (256,128,3,3)
So now my question is : is it even possible to convert custom trained yolov3 model ? And if so, do I need to prepare it before training to fit the official yolov3 model strucutre ? Do I need to create the converter by my own ?
The only changes I got from the real yolov3 model is the cfg file, where I put the classes to 1 and the filters to 18 (as I only need one class, if I understood correctly), the .names file where I only wrote my one class on the first line, and the classes = 1 line in the .data file.
Thank you for your answers,
Florian Millet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Florian,
It seems to be not an issue of OpenVINO. Could you raise this issue in YoloV3 forums and get the help from them to generate the frozen graph such that OpenVINO can be used thereafter?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Florian,
Take a look at this forum discussion where I provide my input for tiny YoloV3. It should be similar to the full version of YOLOv3, you will just need to use a different configuration file (json). Could you share the model optimizer command that you used?
Regards,
Jesus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I can't get to the model optimizer step, I don't manage to convert the .weights file to .pb in the first place (the cannot reshape error), but when I got to the model optimizer with the official yolov3 weights, I used the command provided in the official Intel guide :
python3 mo_tf.py
--input_model /path/to/yolo_v3.pb
--tensorflow_use_custom_operations_config $MO_ROOT/extensions/front/tf/yolo_v3.json
--batch 1
And my custom yolov3.json look like :
[
{
"id": "TFYOLOV3",
"match_kind": "general",
"custom_attributes": {
"classes": 1,
"coords": 4,
"num": 9,
"mask": [3,4,5],
"jitter":0.3,
"ignore_thresh":0.7,
"truth_thresh":1,
"random":1,
"anchors":[10,13,16,30,33,23,30,61,62,45,59,119,116,90,156,198,373,326],
"entry_points": ["detector/yolo-v3/Reshape", "detector/yolo-v3/Reshape_4", "detector/yolo-v3/Reshape_8"]
}
}
]
Regards,
Florian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Florian,
I have shared my experiments on Yolov3 here - https://github.com/vijnasu/OpenVINO-Experiments
Feel free to take and modify the Jupyter notebook and let me know if that solves your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hemanth Kumar G. (Intel) wrote:Hi Florian,
I have shared my experiments on Yolov3 here - https://github.com/vijnasu/OpenVINO-Experiments
Feel free to take and modify the Jupyter notebook and let me know if that solves your issue.
Hi, thank you, but I already manage to perform this on the official yolov3 weight, my problem is when I try it with custom trained model,
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Florian,
Could you try adding the input_shape argument to the model optimizer? Something like
--input_shape [1,416,416,3]
as per your input dataset shape used for training?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hemanth Kumar G. (Intel) wrote:Hi Florian,
Could you try adding the input_shape argument to the model optimizer? Something like
--input_shape [1,416,416,3]
as per your input dataset shape used for training?
Thank you, but as I said earlier, I'm stuck at the convert step, I don't even have a .pb file to give to the model optimizer for now,
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Florian,
It seems to be not an issue of OpenVINO. Could you raise this issue in YoloV3 forums and get the help from them to generate the frozen graph such that OpenVINO can be used thereafter?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Florian,
Would you like to ask if you have solved this problem? I have the same problem as you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am using OpenVINO 2020.1, and I have the same problem.
The convert_weights_pb.py works on coco.names and yolov3.weights,
but not on my 2 class custom trained model. What are the requirement of the yolov3.cfg file of custom trained model, for it to work with convert_weights_pb.py?
Hope somebody has the answer to this issue now!
Thanks
Pih Lung
Error output:
(venv) plp@pihlungs-laptop:~/Documents/code/asl_cust_pt_demo$ python3 convert_weights_pb.py --class_names classes.names --data_format NHWC --weights_file asl_2class_1800.weights
Traceback (most recent call last):
File "convert_weights_pb.py", line 56, in <module>
tf.app.run()
File "/home/plp/.local/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "/home/plp/.local/lib/python3.6/site-packages/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/plp/.local/lib/python3.6/site-packages/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "convert_weights_pb.py", line 46, in main
load_ops = load_weights(tf.global_variables(scope='detector'), FLAGS.weights_file)
File "/home/plp/Documents/code/asl_cust_pt_demo/utils.py", line 115, in load_weights
(shape[3], shape[2], shape[0], shape[1]))
ValueError: cannot reshape array of size 283925 into shape (256,128,3,3)
(venv) plp@pihlungs-laptop:~/Documents/code/asl_cust_pt_demo$
Have tried these "solutions" without any luck!!
https://github.com/mystic123/tensorflow-yolo-v3/issues/15
https://github.com/mystic123/tensorflow-yolo-v3/issues/64
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page