mystic123 / tensorflow-yolo-v3

Implementation of YOLO v3 object detector in Tensorflow (TF-Slim)
https://medium.com/@pawekapica_31302/implementing-yolo-v3-in-tensorflow-tf-slim-c3c55ff59dbe
Apache License 2.0
893 stars 353 forks source link

yolov3_tiny_3l support! #95

Open BackT0TheFuture opened 4 years ago

BackT0TheFuture commented 4 years ago

would you like to add support for yolov3_tiny_3l.cfg? thx!

eizamaliev commented 4 years ago

@goodtogood could you provide weights and some ground-truth data for testing?

BackT0TheFuture commented 4 years ago

@eizamaliev Hi, weights and cfg and some test images are uploaded to google drive, the model was trained for face mask detection. there are two classes, no_mask & face_mask. you can get files following this link

eizamaliev commented 4 years ago

See https://github.com/mystic123/tensorflow-yolo-v3/pull/98

Also I tried to run your model with OpenVINO succesfully. See YOLO demo. If you would have any problem with it, you can freely ask me.

BackT0TheFuture commented 4 years ago

Hi @eizamaliev I can convert darknet weights file to pb of tensorflow using the command below

python convert_weights_pb.py --class_names mask_yvt3l_608.names --data_format NHWC --weights_file mask_yvt3l_608.weights --tiny_3l --size 608 --output_graph mask_yvt3l_608.pb

but error occured when converting to IR of openvino I found the command below by the link

python mo_tf.py --input_model ./mask_yvt3l_608.pb --tensorflow_use_custom_operations_config yolo_v3_tiny_3l.json

how to make yolo_v3_tiny_3l.json correctlly? thanks!

eizamaliev commented 4 years ago

Hi @goodtogood It would much easier if you provided .json file, but fine.

[
  {
    "id": "TFYOLOV3",
    "match_kind": "general",
    "custom_attributes": {
      "classes": 2,
      "anchors": [4,7, 7,15, 13,25,   25,42, 41,67, 75,94,   91,162, 158,205, 250,332],
      "coords": 4,
      "num": 9,
      "masks": [[6,7,8], [3, 4, 5], [0, 1, 2]],
      "entry_points": ["detector/yolo-v3-tiny/Reshape", "detector/yolo-v3-tiny/Reshape_4", "detector/yolo-v3-tiny/Reshape_8"]
    }
  }
]

Also you should add these options for MO --reverse_input_channels --input_shape [1,608,608,3] --input inputs

GotG commented 4 years ago

Hello @eizamaliev

I am trying to convert a slimmed down tiny yolo v3 to OpenVINO trained on 2 classes, mask and no mask. I manage to do that, however when i run inference using the .bin and .xml I get no detections. What do you think is wrong? Thanks!

Below are the weights and the model config. https://drive.google.com/file/d/1Jl-lIJafAYy6mqp6sVn-lCTerfsUjAWz/view?usp=sharing yolo_v3_tiny_mod.txt

eizamaliev commented 4 years ago

Hi @GotG

I not able to answer you question, because you provide too little information. Please, provide:

Will be glad to help!

GotG commented 4 years ago

Hello

The inference in darknet works well using the weights above. To convert the weights to .pb I modify yolo v3 tiny from this repo to fit the config I shared above. Here I already have a problem, as the inference results are different using the .pb in tf vs the original in darknet. Then I convert the .pb to xml and bin using the standard OpenVINO way with the MO (which works well for the regular tiny yolo v3 models). For inference I use your yolo detection code from OMZ python demos. Again, this works for the standard tiny model cfg. But it does not work for the xml from my cfg. There are no detections.

The zip below contains all the files mentioned above: https://drive.google.com/file/d/1PnsxwNKIMugR2zvi24lx3uQX51wr1GN2/view?usp=sharing

Thank you!

GotG commented 3 years ago

Hi @eizamaliev any advice for this?