aim-uofa / AdelaiDet

AdelaiDet is an open source toolbox for multiple instance-level detection and recognition tasks.
https://git.io/AdelaiDet
Other
3.38k stars 650 forks source link

Try to train BlendMask with custom dataset #59

Closed SkeletonOne closed 4 years ago

SkeletonOne commented 4 years ago

Firstly, Thanks for your great work! I am using BlendMask for my custom dataset, containing 10 classes. When starting training, it raises the following error:

[05/11 12:50:28 d2.engine.train_loop]: Starting training from iteration 0 ERROR [05/11 12:50:28 d2.engine.train_loop]: Exception during training: Traceback (most recent call last): File "/content/detectron2/detectron2/engine/train_loop.py", line 132, in train self.run_step() File "/content/detectron2/detectron2/engine/train_loop.py", line 215, in run_step loss_dict = self.model(data) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(*input, *kwargs) File "/content/adet/modeling/blendmask/blendmask.py", line 107, in forward basis_out, basis_losses = self.basis_module(features, basis_sem) File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 550, in call result = self.forward(input, **kwargs) File "/content/adet/modeling/blendmask/basis_module.py", line 96, in forward gt_sem = targets.unsqueeze(1).float() AttributeError: 'NoneType' object has no attribute 'unsqueeze'

Could you give me some advice on how to get rid of it? I checked the code and it says it was used to resize target to reduce memory. Since the default input is None for target, it seems the basis_module did not give a solution for None targets, I guess?

SkeletonOne commented 4 years ago

BTW, the way I use my custom dataset is following the colab tutorial of Detectron2, registering my coco style dataset through

register_coco_instances("mytrain1", {}, "./instances_train2017.json", "./images") register_coco_instances("myval1", {}, "./instances_val2017.json", "./images") register_coco_instances("mytest1", {}, "./instances_test2017.json", "./images")

SkeletonOne commented 4 years ago

I found out that my data does not contain the 'sem_seg' field... Mask R-CNN does not require this so it can be trained normally. Sorry for my interrupt.

sporterman commented 4 years ago

@SkeletonOne how to solve this? the coco format data does not include 'sem_seg' field,

SkeletonOne commented 4 years ago

@sporterman use Adelaidet/datasets/prepare_thing_sem_from_instance.py to generate it

sporterman commented 4 years ago

@SkeletonOne sorry to bother again, i just run 'python datasets/prepare_thing_sem_from_instance.py' and created 'mydataset/thing_train2017/JPEGImages/*.npz' files, but still got the error,

an99990 commented 2 years ago

hey @sporterman did you resolve it ?

kimile599 commented 2 years ago

hey @sporterman did you resolve it ?

i got the category id error, keyerror