mlzxy / devit

CoRL 2024
https://mlzxy.github.io/devit
MIT License
347 stars 46 forks source link

Training on a custom dataset (in VOC format), how can I obtain CLASS_PROTOTYPES? #72

Open liniceyo opened 2 weeks ago

liniceyo commented 2 weeks ago

Hello!

Thank you for your outstanding work. I encountered an issue while running extract_instance_prototypes.py on my custom dataset (in VOC format). The error message I received was: AttributeError: Cannot find field 'gt_masks' in the given Instances!. Could you kindly advise on how I might retrieve the gt_masks?

Thank you very much for your time and assistance.

Best regards

Traceback (most recent call last): File "/media/A/code/lyl/devit-main/./tools/extract_instance_prototypes.py", line 270, in fire.Fire(main) File "/home/com/anaconda3/envs/devit/lib/python3.9/site-packages/fire/core.py", line 135, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "/home/com/anaconda3/envs/devit/lib/python3.9/site-packages/fire/core.py", line 468, in _Fire component, remaining_args = _CallAndUpdateTrace( File "/home/com/anaconda3/envs/devit/lib/python3.9/site-packages/fire/core.py", line 684, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "/media/A/code/lyl/devit-main/./tools/extract_instance_prototypes.py", line 222, in main masks_used = instances.gt_masks.tensor File "/media/A/code/lyl/devit-main/detectron2/structures/instances.py", line 65, in getattr raise AttributeError("Cannot find field '{}' in the given Instances!".format(name)) AttributeError: Cannot find field 'gt_masks' in the given Instances!

liniceyo commented 1 week ago

Hello, thank you very much for your excellent work! I have resolved the issues in the training process, but during inference, an interruption occurs due to bs=0. Could you provide some suggestions on how to resolve this issue?

roi_features=tensor([], device='cuda:0', size=(0, 1024, 49))

-- Process 0 terminated with the following error: Traceback (most recent call last): File "/home/com/anaconda3/envs/devit/lib/python3.9/site-packages/torch/multiprocessing/spawn.py", line 69, in _wrap fn(i, args) File "/media/A/code/lyl/devit-main/tools/../detectron2/engine/launch.py", line 125, in _distributed_worker main_func(args) File "/media/A/code/lyl/devit-main/tools/train_net.py", line 182, in main res = Trainer.test(cfg, model) File "/media/A/code/lyl/devit-main/tools/../detectron2/engine/defaults.py", line 618, in test results_i = inference_on_dataset(model, data_loader, evaluator) File "/media/A/code/lyl/devit-main/tools/../detectron2/evaluation/evaluator.py", line 159, in inference_on_dataset outputs = model(inputs) File "/home/com/anaconda3/envs/devit/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl return forward_call(*input, *kwargs) File "/media/A/code/lyl/devit-main/tools/../detectron2/modeling/meta_arch/devit_update.py", line 748, in forward inter_dist_emb = other_classes.reshape(bs num_active_classes, -1, self.roialign_size, self.roialign_size) RuntimeError: cannot reshape tensor of 0 elements into shape [0, -1, 7, 7] because the unspecified dimension size -1 can be any value and is ambiguous