Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OneFormer #10714

Open
wants to merge 5 commits into
base: dev-3.x
Choose a base branch
from

Conversation

HuYanchen-hub
Copy link

@HuYanchen-hub HuYanchen-hub commented Jul 27, 2023

OneFormer(CVPR2023): https://github.com/SHI-Labs/OneFormer

  •  Aligning inference on coco
-- PQ PQ_th PQ_st AP mIOU
office 57.9 64.4 48.0 49.0 67.2
mmdet 57.9 64.4 48.0 49.0 67.2
# task = panoptic
+--------+--------+--------+--------+------------+
|        | PQ     | SQ     | RQ     | categories |
+--------+--------+--------+--------+------------+
| All    | 57.874 | 83.693 | 68.410 | 133        |
| Things | 64.383 | 84.861 | 75.453 | 80         |
| Stuff  | 48.050 | 81.930 | 57.780 | 53         |
+--------+--------+--------+--------+------------+

coco/segm_mAP: 0.4870  coco/segm_mAP_50: 0.7320  coco/segm_mAP_75: 0.5280  coco/segm_mAP_s: 0.2890  coco/segm_mAP_m: 0.5330  coco/segm_mAP_l: 0.6990

aAcc: 78.8600  mIoU: 67.3800  mAcc: 78.8600

# task = instance
coco/segm_mAP: 0.4900  coco/segm_mAP_50: 0.7350  coco/segm_mAP_75: 0.5300  coco/segm_mAP_s: 0.2930  coco/segm_mAP_m: 0.5360  coco/segm_mAP_l: 0.7020

# task = semantic
aAcc: 78.5900  mIoU: 67.2200  mAcc: 78.5900  data_time: 0.0023  time: 0.3568

The instance segmentation label is aligned with the oneformer official label, using the instance label converted from the panorama segmentation,For details, refer to https://github.com/SHI-Labs/OneFormer/blob/main/datasets/prepare_coco_semantic_annos_from_panoptic_annos.py

@CLAassistant
Copy link

CLAassistant commented Sep 15, 2023

CLA assistant check
All committers have signed the CLA.

@HuYanchen-hub

This comment was marked as outdated.

@TensorNull
Copy link

您好,正好这几天打算在我的baseline上复现oneformer, 我比较仔细地分析了您上传的代码, 我比较不能理解的是您在“oneformer_head.py”文件中, 似乎没有没有在forward函数中对text_tokenizer进行处理,并且没有找到其他位置对其进行处理,这是由于疏忽还是其他原因?从您给出的结果上看似乎和OneFormer官方几乎没有差异,如果代码无误,能解答一下text_tokenizer具体实现的位置吗?十分感谢

@HuYanchen-hub
Copy link
Author

您好,正好这几天打算在我的baseline上复现oneformer, 我比较仔细地分析了您上传的代码, 我比较不能理解的是您在“oneformer_head.py”文件中, 似乎没有没有在forward函数中对text_tokenizer进行处理,并且没有找到其他位置对其进行处理,这是由于疏忽还是其他原因?从您给出的结果上看似乎和OneFormer官方几乎没有差异,如果代码无误,能解答一下text_tokenizer具体实现的位置吗?十分感谢

感谢您的关注,非常抱歉这部分工作因为考虑到代码复用性做了重构,在mmdet已复现的mask2former的基础上进行实现的,目前只做到对齐了推理精度,而上面提到的训练精度对齐是在之前版本的代码上做的,基本上是采用了oneformer算法的实现方式,但是由于git版本回退,那部分commit覆盖掉了。是我的疏忽,感谢您的指正。text_tokenizer需要在训练部分对标签得到的text文本进行处理与oneformer源码应该基本一致。

@TensorNull
Copy link

您好,正好这几天打算在我的baseline上复现oneformer, 我比较仔细地分析了您上传的代码, 我比较不能理解的是您在“oneformer_head.py”文件中, 似乎没有没有在forward函数中对text_tokenizer进行处理,并且没有找到其他位置对其进行处理,这是由于疏忽还是其他原因?从您给出的结果上看似乎和OneFormer官方几乎没有差异,如果代码无误,能解答一下text_tokenizer具体实现的位置吗?十分感谢

感谢您的关注,非常抱歉这部分工作因为考虑到代码复用性做了重构,在mmdet已复现的mask2former的基础上进行实现的,目前只做到对齐了推理精度,而上面提到的训练精度对齐是在之前版本的代码上做的,基本上是采用了oneformer算法的实现方式,但是由于git版本回退,那部分commit覆盖掉了。是我的疏忽,感谢您的指正。text_tokenizer需要在训练部分对标签得到的text文本进行处理与oneformer源码应该基本一致。

我尝试使用您上传的代码,并用此重新搭建了一个虚拟环境,但是始终无法进行训练, 我进行了很多尝试都没有解决这个问题

Traceback (most recent call last):
  File "/nfs/home/3002_hehui/xmx/test/mmdetection/tools/train.py", line 133, in <module>
    main()
  File "/nfs/home/3002_hehui/xmx/test/mmdetection/tools/train.py", line 70, in main
    cfg = Config.fromfile(args.config)
  File "/nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10/site-packages/mmengine/config/config.py", line 474, in fromfile
    raise ImportError(err_msg) from e
ImportError: Failed to import custom modules from {'imports': ['projects.OneFormer.oneformer']}, the current sys.path is: 
    /nfs/home/3002_hehui/xmx/test/mmdetection/tools
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python310.zip
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10/lib-dynload
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10/site-packages
    /nfs/home/3002_hehui/xmx/test/mmdetection
    /tmp/tmpgyi4saoa
You should set `PYTHONPATH` to make `sys.path` include the directory which contains your custom module

当我按照projects/SparseInst的示例中进行训练却可以正常跑通,我对比了SparseInst和OneFormer目录下的代码结构,也不认为OneFormer目录下的代码有问题,但是似乎projects.OneFormer.oneformer 始终无法正常导入, 这是我非常不能理解的

请问您那边使用“hyc_/oneformer”分支的代码能否正常导入OneFormer模块?如果可以,能否提供一份代码给我?感谢🙏

@HuYanchen-hub
Copy link
Author

您好,正好这几天打算在我的baseline上复现oneformer, 我比较仔细地分析了您上传的代码, 我比较不能理解的是您在“oneformer_head.py”文件中, 似乎没有没有在forward函数中对text_tokenizer进行处理,并且没有找到其他位置对其进行处理,这是由于疏忽还是其他原因?从您给出的结果上看似乎和OneFormer官方几乎没有差异,如果代码无误,能解答一下text_tokenizer具体实现的位置吗?十分感谢

感谢您的关注,非常抱歉这部分工作因为考虑到代码复用性做了重构,在mmdet已复现的mask2former的基础上进行实现的,目前只做到对齐了推理精度,而上面提到的训练精度对齐是在之前版本的代码上做的,基本上是采用了oneformer算法的实现方式,但是由于git版本回退,那部分commit覆盖掉了。是我的疏忽,感谢您的指正。text_tokenizer需要在训练部分对标签得到的text文本进行处理与oneformer源码应该基本一致。

我尝试使用您上传的代码,并用此重新搭建了一个虚拟环境,但是始终无法进行训练, 我进行了很多尝试都没有解决这个问题

Traceback (most recent call last):
  File "/nfs/home/3002_hehui/xmx/test/mmdetection/tools/train.py", line 133, in <module>
    main()
  File "/nfs/home/3002_hehui/xmx/test/mmdetection/tools/train.py", line 70, in main
    cfg = Config.fromfile(args.config)
  File "/nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10/site-packages/mmengine/config/config.py", line 474, in fromfile
    raise ImportError(err_msg) from e
ImportError: Failed to import custom modules from {'imports': ['projects.OneFormer.oneformer']}, the current sys.path is: 
    /nfs/home/3002_hehui/xmx/test/mmdetection/tools
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python310.zip
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10/lib-dynload
    /nfs/home/3002_hehui/.conda/envs/mmdet/lib/python3.10/site-packages
    /nfs/home/3002_hehui/xmx/test/mmdetection
    /tmp/tmpgyi4saoa
You should set `PYTHONPATH` to make `sys.path` include the directory which contains your custom module

当我按照projects/SparseInst的示例中进行训练却可以正常跑通,我对比了SparseInst和OneFormer目录下的代码结构,也不认为OneFormer目录下的代码有问题,但是似乎projects.OneFormer.oneformer 始终无法正常导入, 这是我非常不能理解的

请问您那边使用“hyc_/oneformer”分支的代码能否正常导入OneFormer模块?如果可以,能否提供一份代码给我?感谢🙏

非常抱歉,因为一些原因我也找不到原始版本代码了,能找到的代码都在这个pr里了,看您的报错是路径问题,或许您可以尝试使用pip install -e -v .重现安装mmdet试一下

tbroed added a commit to tbroed/efcl_mmdetection that referenced this pull request Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants