LiWentomng / boxlevelset

The code for "Box-supervised Instance Segmentation with Level Set Evolution(ECCV2022)"
Apache License 2.0
185 stars 25 forks source link

对于自己的数据集,在build时不会创建flag变量,导致group_sampler出错 #19

Closed zebbsb closed 1 year ago

zebbsb commented 1 year ago

十分感谢您分享的代码以及您工作对我的论文的启发!但是在我在单gpu运行时,遇到了和[https://github.com/LiWentomng/boxlevelset/issues/14#issue-1559569880]相同的问题,在运行到/boxlevelset/mmdet/datasets/samplers/group_sampler.py文件中第36行的: indices = np.concatenate(indices)时,报错: File "<__array_function__ internals>",line 6, in concatenate ValueError: need at least one array to concatenate. 我在debug后发现是因为我的数据集尽管做成了coco格式,但是在train.py中调用build_datasets会运行到最后的else分支,并且调用build_from_cfg(cfg, DATASETS, default_args),但这个方法没有像其他的分支中的方法一样在创建dataset对象时定义flag变量。从而使得Group_sampler类在初始化的时候,self.flag.self.group_sizes都是空对象,从而导致indices也是空对象,发生这个错误。请问是否有解决的办法呢?我已经验证过数据,并没有错误的标注,数据集是可以被cocoAPI调用的。

zebbsb commented 1 year ago

Solution: wrong class for coco dataset in datasets/coco.py

SSZ1 commented 4 weeks ago

Solution: wrong class for coco dataset in datasets/coco.py

您好,我想咨询一下您,具体是怎么解决的呢,没看懂这个,这个coco.py文件是在哪里呢

zebbsb commented 4 weeks ago

Solution: wrong class for coco dataset in datasets/coco.py

您好,我想咨询一下您,具体是怎么解决的呢,没看懂这个,这个coco.py文件是在哪里呢

这个问题是由于自己设置的数据集的类别与在mmdet框架下默认的coco数据集类别不一致导致的,需要修改项目路径下的mmdet文件夹中的datasets/coco.py中默认的coco数据集的CLASSES,让里面的类别标注名称和自己的数据集相同,我是这么解决的