Azzera filtri
Azzera filtri

Error training Yolo V4 object detector

46 visualizzazioni (ultimi 30 giorni)
Jose
Jose il 27 Apr 2024
Commentato: Jose il 15 Lug 2024 alle 13:12
Hi,
I am running the scripts in Gazebo Simulation of Semi-Structured Intelligent Bin Picking for UR5e Using YOLO and PCA-Based Object Detection example and everthing works well. However, when I try to train the detector by using the trainYoloV4ForSimCuboidObject.mlx live script, I get this error:
Intermediate dot '.' indexing produced a comma-separated list with 0 values, but it must produce a single value when followed by subsequent indexing operations.
plY{i} = layerAnalyzer.Outputs.Meta{1};
[sizes, formats] = iForwardExampleInputsLayerGraph(net, opts.Outputs, X{:});
[orderedNetworkActivationSizes, ~] = deep.internal.sdk.forwardDataAttributes(lgraph,'Outputs',orderedDetectionNetworkSource);
[lgraph, params.DetectionNetworkSource] = iConfigureDetector(lgraph,numClasses,params.AnchorBoxes,params.DetectionNetworkSource,params.PredictedBoxType);
params = yolov4ObjectDetector.parseDetectorInputs(varargin{:});
I didn't change anything and I provided the recommended donwnloaded dataset folders. So, what could be the cause of this error?
  2 Commenti
Ali
Ali il 16 Giu 2024
Hi Jose,
I got the same error when trying to train my own network. I don't have a solution but I may be able to share a bit of useful insight for someone.
Tracing it through, it took me to the line : deep.internal.sdk.forwardDataAttributes(lgraph,'Outputs',orderedDetectionNetworkSource)
The lgraph that I am passing it appears to be a 1x0 empty array so when it tries to form the output names, I think it is falling over on the dot indexing there.
It may be because you (like me) used googleNet. When the outputs are pooled together I presume the output of this is 1 and therefore the layerWithLowestOutputSize function returns this and then subsequently removes it on line 1877: lgraph = iRemoveLayersAfterSpecifiedLayerAndUnconnectedLayers(lgraph,layerWithLowestOutputSize);
Removing a pool is not going to do the network any good at all.
Without the above line being altered, I can't see how it can progress hence why I am a bit puzzled myself - we are pretty deep at this point, pun intended :).
Apologies I can't be more help, but it might spark a lightbulb for someone more familiar with this.
(I can confirm that changing the network to squeezeNet doesn't fix it when set up the same way, again perhaps as the outputs are pooled in this one as well.)
Kind regards,
Alastair
Jose
Jose il 17 Giu 2024
Hi Alastair,
thank you very much for bringing more information to this topic. It might be useful to someonelse who could provide any help. In my case, the eventual use of YOLO will be from ROS2, so I am considering working directly with a Python wrapper.
However, for the sake of clarity, I am still wondering how it is possible to get this error when using strictly an official example. I think It could be a matter of incompatibility of versions.
Regards

Accedi per commentare.

Risposta accettata

Garmit Pant
Garmit Pant il 12 Lug 2024 alle 10:09
Hello Jose
The error you have encountered is due to the initialization of the ‘yolov4ObjectDetector’ on line 73 in the MLX-File ‘trainYoloV4ForSimCuboidObject.mlx’.
In the ‘trainYoloV4ForSimCuboidObject.mlx’ file, the ‘detector’ object is first initialized as a pretrained tiny YOLOv4 COCO object detector. It is then modified to have just one class. When trying to modify the detector in line 73, the ‘baseNetwork’ passed as the base network input argument is the network of the pretrained YOLOv4 detector initialised earlier. This creates the error. The ‘baseNet’ input argument expects a backbone network for the YOLOv4 detector, like ‘resnet50’ etc.
The correct methodology to solve this is to extract the backbone network of the pretrained detector and then pass that as the ‘baseNetwork’ input argument.
A possible workaround is to replace line 73 with the following code snippet:
detector = yolov4ObjectDetector('tiny-yolov4-coco', classNames, anchorBoxes);
For further understanding, kindly refer to the following MathWorks Documentation:
I hope you find the above explanation and suggestions useful!

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by