'Number of channels in input image must be 3' error when trying to train in YOLO v2

5 views (last 30 days)
I am trying to apply YOLO v2 in my dataset to train images (greyscale x-ray images). After first epoch it is giving the following error.
Bounding boxes must be fully contained within their associated image and must have positive width and height.
Training on single CPU.
|========================================================================================|
| Epoch | Iteration | Time Elapsed | Mini-batch | Mini-batch | Base Learning |
| | | (hh:mm:ss) | RMSE | Loss | Rate |
|========================================================================================|
| 1 | 1 | 00:04:49 | 42.32 | 1791.2 | 0.0010 |
Error using vision.internal.cnn.yolo.yolov2Datastore>iYOLOv2ChannelAugmentation (line 238)
Number of channels in input image must be 3.
Error in vision.internal.cnn.yolo.yolov2Datastore/readByIndex (line 123)
img = iYOLOv2ChannelAugmentation(img,ds.DatastoreOutSize(1,3));
Error in vision.internal.cnn.yolo.yolov2Datastore/read (line 156)
[data,info] = readByIndex(ds,indices);
Error in nnet.internal.cnn.MultiInputMultiOutputMiniBatchDatastoreDispatcher/next (line 179)
this.Datastore.read());
Error in nnet.internal.cnn.Trainer/train (line 108)
[X, response] = data.next();
Error in vision.internal.cnn.trainNetwork (line 48)
trainedNet = trainer.train(trainedNet, trainingDispatcher);
Error in trainYOLOv2ObjectDetector>iTrainYOLOv2 (line 363)
ds, lgraph, opts, executionSettings, mapping, checkpointSaver, ...
Error in trainYOLOv2ObjectDetector (line 145)
[net, info] = iTrainYOLOv2(ds, lgraph, trainingData, params, mapping, options, checkpointSaver);
Error in trainYOLO (line 65)
[detector,info] = trainYOLOv2ObjectDetector(teethDataset,lgraph,options);

Accepted Answer

KALYAN ACHARJYA
KALYAN ACHARJYA on 22 May 2019
Edited: KALYAN ACHARJYA on 22 May 2019
I am gussing from thr error-
'Number of channels in input image must be 3' &
"I am trying to apply YOLO v2 in my dataset to train images (greyscale x-ray images)."
The model may accept RGB images/colors, which have 3 channels

More Answers (1)

ping.jiang
ping.jiang on 13 Jun 2019
捕获.PNG 将最后一个卷积层改为3.

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!