You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To run detectron2 for imaging with 5 channels I followed #2062 . I have implement a custom dataloader and changed PIXEL_MEAN/STD but I have this error:
FloatingPointError: Loss became infinite or NaN at iteration=4!
loss_dict = {'loss_cls': 0.5807800889015198, 'loss_box_reg': 0.0, 'loss_mask': 0.0, 'loss_rpn_cls': 6.5862717628479, 'loss_rpn_loc': inf}
This is the implementation of class Trainer(DefaultTrainer)
def custom_mappe(dataset_dict):
dataset_dict = copy.deepcopy(dataset_dict) # it will be modified by code below
# can use other ways to read image
image=read_tiff_with_5_bands(dataset_dict["file_name"])
#image = utils.read_image(dataset_dict["file_name"], format="BGR")
# See "Data Augmentation" tutorial for details usage
#auginput = T.AugInput(image)
#transform = T.Resize((650, 650))(auginput)
#image = torch.from_numpy(auginput.image.transpose(2, 0, 1))
'''
annos = [
utils.transform_instance_annotations(annotation, [transform], image.shape[1:])
for annotation in dataset_dict.pop("annotations")
]
'''
annos=[]
for annotation in dataset_dict.pop("annotations"):
annos+=[annotation]
image = torch.from_numpy(image.transpose(2, 0, 1))
return {
# create the format that the model expects
"image": image,
"instances":utils.annotations_to_instances(annos, image.shape[1:]),
#"istances":dataset_dict['annotations'],
"width":dataset_dict['width'],
"height":dataset_dict['height']
}
class Trainer(DefaultTrainer): @classmethod
def build_train_loader(cls, cfg):
return build_detection_train_loader(cfg, mapper=custom_mappe)
The text was updated successfully, but these errors were encountered:
To run detectron2 for imaging with 5 channels I followed #2062 . I have implement a custom dataloader and changed PIXEL_MEAN/STD but I have this error:
FloatingPointError: Loss became infinite or NaN at iteration=4!
loss_dict = {'loss_cls': 0.5807800889015198, 'loss_box_reg': 0.0, 'loss_mask': 0.0, 'loss_rpn_cls': 6.5862717628479, 'loss_rpn_loc': inf}
This is the implementation of class Trainer(DefaultTrainer)
def custom_mappe(dataset_dict):
dataset_dict = copy.deepcopy(dataset_dict) # it will be modified by code below
# can use other ways to read image
image=read_tiff_with_5_bands(dataset_dict["file_name"])
#image = utils.read_image(dataset_dict["file_name"], format="BGR")
# See "Data Augmentation" tutorial for details usage
class Trainer(DefaultTrainer):
@classmethod
def build_train_loader(cls, cfg):
return build_detection_train_loader(cfg, mapper=custom_mappe)
The text was updated successfully, but these errors were encountered: