ArmDeveloperEcosystem / ml-object-detection-examples-for-imx93

ML Object Detection Examples for i.MX 93
MIT License
1 stars 2 forks source link

post_processing_model error #1

Closed reikote closed 3 months ago

reikote commented 3 months ago

I'm using detectnet-v2 model from NGC. This output format is cov: (1,3,24,78) bbox: (1,12,24,78).

so I set in "main.py" post_processor = PostProcessingModel((24, 78))

But it happened error when execute, cov, bbox = post_processor.predict(cov, bbox)

Could you have any solution?

///////////////////////// Traceback (most recent call last): File "C:\Users\VSCode\tensorflow-lite\PeopleNet-test.py", line 69, in cov, bbox = post_processor.predict(cov, bbox) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\12211\Documents\VSCode\tensorflow-lite\post_processing_model.py", line 26, in predict bbox[:, :, :, :, 0] = self.centers_x - self.scale * bbox[:, :, :, :, 0]


ValueError: operands could not be broadcast together with shapes (78,1) (1,3,24,78)
/////////////////////////
sandeepmistry commented 3 months ago

Hi @reikote,

Any chance you can share the .tflite file or screenshot of the model in Netron.app?

I think the output index for bbox and cov might be swapped and https://github.com/ArmDeveloperEcosystem/ml-object-detection-examples-for-imx93/blob/main/detectnet_v2/detect_net_v2_model.py#L43-L44 needs to be adjusted.

reikote commented 3 months ago

Hi @sandeepmistry

Thank you for your reply. I have resolved this because of you. As you say, it was swapped.

My model output sharp is: Cov: (1,3,24,78) Bbox: (1,12,24,78)

I execute np.transpose. cov = np.transpose(cov, (0, 2, 3, 1)) bbox = np.transpose(bbox, (0, 2, 3, 1)) Cov: (1,24,78,3) Bbox: (1,24,78,12)

Thank you for your kind cooperation!!

( It works it well now, but next issue is happened. create_nms_model.py can't work well. Maybe this code is made by old tensorflow version.)