Я тестировал загрузчик данных отдельно, и он работает и печатает пакетные изображения и детали BB
Также я пытался распечатать потери в NN, и он печатает пакетное значение а также, и после этого возникает ОШИБКА.
Код: Выделить всё
img_process = v2.Compose(
[
v2.ToTensor(),
v2.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
]
)
class SCocoDetection(datasets.CocoDetection):
def __init__(
self,
image_directory_path: str,
annotation_path : str,
train: bool = True,
image_processor = None
):
super().__init__(image_directory_path, annotation_path)
self.image_processor = image_processor
def __getitem__(self, idx):
image, annotations = super().__getitem__(idx)
images, targets = [], []
image_id = self.ids[idx]
for ann in annotations:
bbox = ann['bbox']
#small = (bbox[:, 2] * bbox[:, 3])
Подробнее здесь: [url]https://stackoverflow.com/questions/79151398/view-size-is-not-compatible-with-input-tensors-size-and-stride[/url]
Мобильная версия