Lam1360 / YOLOv3-model-pruning

在 oxford hand 数据集上对 YOLOv3 做模型剪枝(network slimming)
MIT License
1.67k stars 431 forks source link

稀疏化训练bbox问题 #71

Open sunserforever opened 4 years ago

sunserforever commented 4 years ago

Traceback (most recent call last): File "train.py", line 128, in for batchi, (, imgs, targets) in enumerate(dataloader): File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 346, in next data = self.dataset_fetcher.fetch(index) # may raise StopIteration File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/notebooks/home/zxm/code/YOLOv3-model-pruning-master/utils/datasets.py", line 128, in getitem img, boxes = augment(img, boxes) File "/notebooks/home/zxm/code/YOLOv3-model-pruning-master/utils/augmentations.py", line 29, in augment augmented = aug(image=image, bboxes=boxes_coord, category_id=labels) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/core/composition.py", line 174, in call p.preprocess(data) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/core/utils.py", line 63, in preprocess data[data_name] = self.check_and_convert(data[data_name], rows, cols, direction="to") File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/core/utils.py", line 71, in check_and_convert return self.convert_to_albumentations(data, rows, cols) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 51, in convert_to_albumentations return convert_bboxes_to_albumentations(data, self.params.format, rows, cols, check_validity=True) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 303, in convert_bboxes_to_albumentations return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes] File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 303, in return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes] File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 251, in convert_bbox_to_albumentations check_bbox(bbox) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 334, in check_bbox raise ValueError("x_max is less than or equal to x_min for bbox {bbox}.".format(bbox=bbox)) ValueError: x_max is less than or equal to x_min for bbox (0.31484375000000003, 0.390625, 0.31484375000000003, 0.390625, 2.0). 想请问各位大佬,在稀疏化时候遇到bbox边框问题,是什么原因,该怎么样处理。

ethan-sui commented 4 years ago

Traceback (most recent call last): File "train.py", line 128, in for batchi, (, imgs, targets) in enumerate(dataloader): File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 346, in next data = self.dataset_fetcher.fetch(index) # may raise StopIteration File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/notebooks/home/zxm/code/YOLOv3-model-pruning-master/utils/datasets.py", line 128, in getitem img, boxes = augment(img, boxes) File "/notebooks/home/zxm/code/YOLOv3-model-pruning-master/utils/augmentations.py", line 29, in augment augmented = aug(image=image, bboxes=boxes_coord, category_id=labels) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/core/composition.py", line 174, in call p.preprocess(data) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/core/utils.py", line 63, in preprocess data[data_name] = self.check_and_convert(data[data_name], rows, cols, direction="to") File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/core/utils.py", line 71, in check_and_convert return self.convert_to_albumentations(data, rows, cols) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 51, in convert_to_albumentations return convert_bboxes_to_albumentations(data, self.params.format, rows, cols, check_validity=True) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 303, in convert_bboxes_to_albumentations return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes] File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 303, in return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes] File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 251, in convert_bbox_to_albumentations check_bbox(bbox) File "/root/anaconda3/envs/pytorch/lib/python3.6/site-packages/albumentations/augmentations/bbox_utils.py", line 334, in check_bbox raise ValueError("x_max is less than or equal to x_min for bbox {bbox}.".format(bbox=bbox)) ValueError: x_max is less than or equal to x_min for bbox (0.31484375000000003, 0.390625, 0.31484375000000003, 0.390625, 2.0). 想请问各位大佬,在稀疏化时候遇到bbox边框问题,是什么原因,该怎么样处理。

请问你解决了吗

qianlinjun commented 4 years ago

去掉水平反转增强试试 aug = A.Compose([

A.HorizontalFlip(p=0.5),

    A.HueSaturationValue(hue_shift_limit=10, sat_shift_limit=10, val_shift_limit=10, p=0.5),
    # A.ShiftScaleRotate(shift_limit=0.1, scale_limit=0.1, rotate_limit=5, border_mode=0, p=0.5)
], bbox_params={'format':'coco', 'label_fields': ['category_id']})
ethan-sui commented 4 years ago

去掉水平反转增强试试 aug = A.Compose([

A.HorizontalFlip(p=0.5),

A.HueSaturationValue(hue_shift_limit=10, sat_shift_limit=10, val_shift_limit=10, p=0.5),

A.ShiftScaleRotate(shift_limit=0.1, scale_limit=0.1, rotate_limit=5, border_mode=0, p=0.5)

], bbox_params={'format':'coco', 'label_fields': ['category_id']})

方便加个好友吗,QQ:2803788198