Error training Yolo V4 object detector
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
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
Risposta accettata
Garmit Pant
il 12 Lug 2024
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:
- Refer to the ‘Input Arguments’ section to understand how to correctly set up the max pooling layer: https://www.mathworks.com/help/vision/ref/yolov4objectdetector.html
I hope you find the above explanation and suggestions useful!
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!