(-215: утверждение не выполнено)! _Sr c .empty () в функции 'cv :: cvtColor' ошибка при обучении набора данных - PullRequest
2 голосов
/ 18 апреля 2020

Я пытался обучить набор данных. directory Это файлы, которые я поместил тренировочные образы в images и json в annotations. Кроме того, Train.py находится в enter image description here Затем я выполнил эти 2 команды.

cd C:\Users\mustafa\Desktop\EfficientDet-master

python train.py --snapshot imagenet --phi 0 --gpu 0 --random-transform --compute-val-loss --freeze-backbone --batch-size 4 --steps 100 coco C:/Users/mustafa/Downloads/deneme.v1-1.coco/datasets/coco

Впоследствии я увидел эту ошибку.

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 "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\util\depr
ecation.py", line 324, in new_func
    return func(*args, **kwargs)
  File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\training.py", line 1577, in fit_generator
    initial_epoch=initial_epoch)
  File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\training.py", line 71, in _method_wrapper
    return method(self, *args, **kwargs)
  File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\training.py", line 886, in fit
    steps_per_execution=self._steps_per_execution)
  File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\data_adapter.py", line 1138, in __init__
    model=model)
  File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\data_adapter.py", line 923, in __init__
    **kwargs)
  File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\data_adapter.py", line 787, in __init__
    peek, x = self._peek_and_restore(x)
  File "C:\Users\mustafa\anaconda3\lib\site-packages\tensorflow\python\keras\eng
ine\data_adapter.py", line 927, in _peek_and_restore
    return x[0], x
  File "C:\Users\mustafa\Desktop\EfficientDet-master\generators\common.py", line
 424, in __getitem__
    inputs, targets = self.compute_inputs_targets(group)
  File "C:\Users\mustafa\Desktop\EfficientDet-master\generators\common.py", line
 373, in compute_inputs_targets
    image_group = self.load_image_group(group)
  File "C:\Users\mustafa\Desktop\EfficientDet-master\generators\common.py", line
 225, in load_image_group
    return [self.load_image(image_index) for image_index in group]
  File "C:\Users\mustafa\Desktop\EfficientDet-master\generators\common.py", line
 225, in <listcomp>
    return [self.load_image(image_index) for image_index in group]
  File "C:\Users\mustafa\Desktop\EfficientDet-master\generators\coco.py", line 1
32, in load_image
    image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\co
lor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtCo
lor'

load_image функция в coco.py

def load_image(self, image_index):
        """
        Load an image at the image_index.
        """
        # {'license': 2, 'file_name': '000000259765.jpg', 'coco_url': 'http://images.cocodataset.org/test2017/000000259765.jpg', 'height': 480, 'width': 640, 'date_captured': '2013-11-21 04:02:31', 'id': 259765}
        image_info = self.coco.loadImgs(self.image_ids[image_index])[0]
        path = os.path.join(self.data_dir, 'images', self.set_name, image_info['file_name'])
        print(path)
        image = cv2.imread(path)
        image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
        return image
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...