简体   繁体   English

在最后一个时期训练时出现断言错误

[英]Assertion Error while training on last epoch

I have used a model from this repo.我使用了这个 repo 中的 model。 I want to train it again to improve performance.我想再次训练它以提高性能。 This is my training command.这是我的训练命令。

!python train.py --snapshot efficientdet-d0.h5 --phi 0 --gpu 0 --weighted-bifpn --random-transform --compute-val-loss --freeze-bn --batch-size 4 --steps 100 coco datasets/coco

And the directory of folders:和文件夹的目录:

在此处输入图像描述

The first 99 epochs work well.前 99 个 epoch 运行良好。

99/100 [============================>.] - ETA: 0s - loss: 0.3978 - classification_loss: 0.2983 - regression_loss: 0.0995datasets/coco/images/train2017/i.rf.4eba631a9cf8fef57df45f64cf16f258.jpg
datasets/coco/images/train2017/i.rf.3bb1c054edd9e0b91f8944b797c28eac.jpg
datasets/coco/images/train2017/i.rf.8dba641d2187f073238f34fddd5499fc.jpg
datasets/coco/images/train2017/i.rf.bfd984b934688cdca720056e6733219d.jpg
datasets/coco/images/train2017/i.rf.2d0be24e1ac8afdd69ebb9cf03367be5.jpg
datasets/coco/images/train2017/i.rf.a6a1177aa50ae605fe184b766421d4c4.jpg
100/100 [==============================] - ETA: 0s - loss: 0.3959 - classification_loss: 0.2966 - regression_loss: 0.0993datasets/coco/images/val2017/000000061960.jpg

Afterwards, I see this error:之后,我看到这个错误:

Traceback (most recent call last):
  File "train.py", line 381, in <module>
    main()
  File "train.py", line 376, in main
    validation_data=validation_generator
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 1482, in fit_generator
    initial_epoch=initial_epoch)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 66, in _method_wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 875, in fit
    return_dict=True)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 66, in _method_wrapper
    return method(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py", line 1060, in evaluate
    model=self)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 1112, in __init__
    model=model)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 908, in __init__
    **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 772, in __init__
    peek, x = self._peek_and_restore(x)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/data_adapter.py", line 912, in _peek_and_restore
    return x[0], x
  File "/content/drive/My Drive/EfficientDet-master/generators/common.py", line 424, in __getitem__
    inputs, targets = self.compute_inputs_targets(group)
  File "/content/drive/My Drive/EfficientDet-master/generators/common.py", line 373, in compute_inputs_targets
    image_group = self.load_image_group(group)
  File "/content/drive/My Drive/EfficientDet-master/generators/common.py", line 225, in load_image_group
    return [self.load_image(image_index) for image_index in group]
  File "/content/drive/My Drive/EfficientDet-master/generators/common.py", line 225, in <listcomp>
    return [self.load_image(image_index) for image_index in group]
  File "/content/drive/My Drive/EfficientDet-master/generators/coco.py", line 132, in load_image
    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

The error means that the image (from a file path) that is currently trying to be processed could no be found.该错误意味着找不到当前尝试处理的图像(来自文件路径)。 If you look at the training output, you'll see that all the image paths come from datasets/coco/images/train2017/ , but the very last line says is looking for a file in datasets/coco/images/val2017 .如果您查看训练 output,您会看到所有图像路径都来自datasets/coco/images/train2017/ ,但最后一行说正在寻找datasets/coco/images/val2017中的文件。

The script is done training and is looking for validatioon/testing data, which I suspect it can't find.该脚本已完成培训,正在寻找验证/测试数据,我怀疑它找不到。 Check that the val2017 directory exists, and that there are images in the directory that can be loaded with cv.imread() .检查val2017目录是否存在,以及目录中是否有可以使用cv.imread()加载的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Tensorflow 评估给出的误差大于训练的最后一个时期 - Tensorflow evaluate gives larger error than last epoch of training 在第 14 个 Epoch 在 Imagenet 上训练 Resnet50 时出错 - Getting an error while training Resnet50 on Imagenet at 14th Epoch 在运行训练 model 以使用 keras 进行面部表情检测时出现错误 - Getting Error after Epoch While running a training model for facial expression detection using keras OpenCV2 错误:(-215:Assertion failed) 'cv::resize' while training the model - OpenCV2 error: (-215:Assertion failed) 'cv::resize' while training the model Tensorflow 训练在音频分类器的第一个时期的最后一步崩溃 - Tensorflow Training Crashes in last step of first epoch for audio classifier 如何在 n 个时期后调用回调,但始终在训练的最后一个时期? - How to call callback after n epochs but always in the last epoch of training? 使用 keras VGGFace 框架训练 CNN 时,Epoch 未启动 - Epoch does not start while training CNN with keras VGGFace Framework 训练停留在 Epoch 3 PyTorch - Training stuck at Epoch 3 PyTorch 在python中的神经网络中训练数据时出现断言错误? - Getting Assertion Error when training data in neural network in python? 重新运行model.fit时,逐步衰减训练不会保留最后一个历元。 学习率错误 - Training with step decay not retaining the last epoch when re-running model.fit. Learning rate wrong
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM