onnx / onnx/models

Predictions of custom converted YOLOv4 model

Open
#443 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Jupyter Notebook
Stars
9.8k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Ask a Question

Question

Hi. I'm new to inference using ONNX and I'm getting troubles to use the predictions I get using my custom YOLOv4 model, recently converted thanks to this notebook.

Then, I wanted to use the notebook for inference, but I'm not getting the same kind of output. Instead of something like [(1, 52, 52, 3, 85), (1, 26, 26, 3, 85), (1, 13, 13, 3, 85)], I get [(1, 46, 15)].
Next, I get the following error using the postprocess_bbox function:

<ipython-input-3-265b08cda32c> in postprocess_bbbox(pred_bbox, ANCHORS, STRIDES, XYSCALE)
     28         conv_shape = pred.shape
     29         output_size = conv_shape[1]
---> 30         conv_raw_dxdy = pred[:, :, :, :, 0:2]
     31         conv_raw_dwdh = pred[:, :, :, :, 2:4]
     32         xy_grid = np.meshgrid(np.arange(output_size), np.arange(output_size))

IndexError: too many indices for array: array is 3-dimensional, but 5 were indexed

Of course, it does not have the same shape... But I don't understand the meaning of the shape I obtain, knowing that my model output 11 classes and the input resolution is 416, just like the example. In case it helps, my output_names is : [tf.concat_16]

In my custom model, I did not change the anchors, the strides nor the xy scales, it was simply trained with the default values.
Does anyone know the meaning of the shape I get or what's wrong with my model to obtain such a shape?

Is this issue related to a specific model?

Model name (e.g. mnist): YOLOv4 (custom)
Model opset (e.g. 7): 11 (default in the notebook)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with dependencies/Conversion.ipynb and dependencies/inference.ipynb, then inspect the custom model's output_names and tensor shape before postprocess_bbox. Compare the converted custom model with the example's expected output tensors; done means the shape is explained and the inference/postprocessing path is shown to be compatible or the incompatibility is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, numpy, python
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.