Open TNT028 opened 2 months ago
Thanks for your recognition of our work. maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py is uploaded with a new version, you can download it and try again. BTW, I will delete the implementation of VTSCN of TransLike_GCL because they are incomplete and has not been run before. In our paper, we reported three baseline models, i.e. MOTIFS, VCTree and VTransE.
Thanks for your recognition of our work. maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py is uploaded with a new version, you can download it and try again. The occurence of this error is because some codes in maskrcnn_benchmark are from the original benchmark of TDE. The dismatch between SHA-GCL and TDE causes this error. I am not sure if there are another dismatch errors. If you meet again, please let me know and I will recheck the code. BTW, I will delete the implementation of VTSCN of TransLike_GCL because they are incomplete and has not been run before. In our paper, we reported three baseline models, i.e. MOTIFS, VCTree and VTransE.
Thanks for your reply. I am sorry to bother you again. I have tried this new py and this issue is solved. But a new problem has arisen.
Traceback (most recent call last): File "tools/relation_train_net.py", line 24, in from maskrcnn_benchmark.modeling.detector import build_detection_model File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/detector/init.py", line 2, in from .detectors import build_detection_model File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/detector/detectors.py", line 2, in from .generalized_rcnn import GeneralizedRCNN File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 13, in from ..roi_heads.roi_heads import build_roi_heads File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/roi_heads.py", line 4, in from .box_head.box_head import build_roi_box_head ImportError: cannot import name 'build_roi_box_head' from 'maskrcnn_benchmark.modeling.roi_heads.box_head.box_head' (/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py) Traceback (most recent call last): File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/site-packages/torch/distributed/launch.py", line 260, in main() File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/site-packages/torch/distributed/launch.py", line 255, in main raise subprocess.CalledProcessError(returncode=process.returncode, subprocess.CalledProcessError: Command '['/home/yons/anaconda3/envs/VTSCN/bin/python', '-u', 'tools/relation_train_net.py', '--local_rank=0', '--config-file', 'configs/SHA_GCL_e2e_relation_X_101_32_8_FPN_1x.yaml', 'GLOBAL_SETTING.DATASET_CHOICE', 'VG', 'GLOBAL_SETTING.RELATION_PREDICTOR', 'MotifsLikePredictor', 'GLOBAL_SETTING.BASIC_ENCODER', 'Motifs', 'GLOBAL_SETTING.GCL_SETTING.GROUP_SPLIT_MODE', 'divide4', 'GLOBAL_SETTING.GCL_SETTING.KNOWLEDGE_TRANSFER_MODE', 'KL_logit_TopDown', 'MODEL.ROI_RELATION_HEAD.USE_GT_BOX', 'True', 'MODEL.ROI_RELATION_HEAD.USE_GT_OBJECT_LABEL', 'True', 'SOLVER.IMS_PER_BATCH', '8', 'TEST.IMS_PER_BATCH', '8', 'DTYPE', 'float16', 'SOLVER.MAX_ITER', '60000', 'SOLVER.VAL_PERIOD', '5000', 'SOLVER.CHECKPOINT_PERIOD', '5000', 'GLOVE_DIR', '/home/yons/scene/VTSCN/datasets/vg/glove', 'OUTPUT_DIR', '/home/yons/scene/VTSCN/datasets/output/SHA_GCL_VG_PredCls_test']' returned non-zero exit status 1.
Oh, the wrong file is maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_feature_extractors.py, but I mix it up with maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py. I am sorry, and please download these two files again. If you want to reimplement our VTSCN, 'GLOBAL_SETTING.RELATION_PREDICTOR' needs to be 'MotifsLike_GCL' or 'VCTree_GCL'.
But the first bug you raised may occur again because the codes are not changed actually. As the first bug shown that File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_feature_extractors.py", line 166, in make_roi_box_feature_extractor return func(cfg, in_channels, half_out, cat_all_levels) TypeError: init() takes 3 positional arguments but 5 were given The ROI_BOX_HEAD.FEATURE_EXTRACTOR is FPN2MLPFeatureExtractor by default, which should take 5 arguments(roi_box_feature_extractor.py, line55): def init(self, cfg, in_channels, half_out=False, cat_all_levels=False): Maybe you can debug and check if the ROI_BOX_HEAD.FEATURE_EXTRACTOR is set correctly.
But the first bug you raised may occur again because the codes are not changed actually. As the first bug shown that File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_feature_extractors.py", line 166, in make_roi_box_feature_extractor return func(cfg, in_channels, half_out, cat_all_levels) TypeError: init() takes 3 positional arguments but 5 were given The ROI_BOX_HEAD.FEATURE_EXTRACTOR is FPN2MLPFeatureExtractor by default, which should take 5 arguments(roi_box_feature_extractor.py, line55): def init(self, cfg, in_channels, half_out=False, cat_all_levels=False): Maybe you can debug and check if the ROI_BOX_HEAD.FEATURE_EXTRACTOR is set correctly.
You are right. It has indeed reappeared again. Thank you for your guidance. I'll give it a try to check. If you have any new ideas, please contact me as soon as possible. I would greatly appreciate it.
I have downloaded my code and rerun them, and no bug occurs. The GLOBAL_SETTING.RELATION_PREDICTOR is set as 'MotifsLike_GCL', and GLOBAL_SETTING.BASIC_ENCODER is set as 'Motifs'.
Thanks for you code. However, when I run "CUDA_VISIBLE_DEVICES=0 python -m torch.distributed.launch --master_port 10025 --nproc_per_node=1 tools/relation_train_net.py --config-file "configs/SHA_GCL_e2e_relation_X_101_32_8_FPN_1x.yaml" GLOBAL_SETTING.DATASET_CHOICE 'VG' GLOBAL_SETTING.RELATION_PREDICTOR 'TransLike_GCL' GLOBAL_SETTING.BASIC_ENCODER 'Hybrid-Attention' GLOBAL_SETTING.GCL_SETTING.GROUP_SPLIT_MODE 'divide4' GLOBAL_SETTING.GCL_SETTING.KNOWLEDGE_TRANSFER_MODE 'KL_logit_TopDown' MODEL.ROI_RELATION_HEAD.USE_GT_BOX True MODEL.ROI_RELATION_HEAD.USE_GT_OBJECT_LABEL True SOLVER.IMS_PER_BATCH 8 TEST.IMS_PER_BATCH 8 DTYPE "float16" SOLVER.MAX_ITER 60000 SOLVER.VAL_PERIOD 5000 SOLVER.CHECKPOINT_PERIOD 5000 GLOVE_DIR /home/yons/scene/VTSCN/datasets/vg/glove OUTPUT_DIR /home/yons/scene/VTSCN/datasets/output/SHA_GCL_VG_PredCls_test" with SHA-GCL-for-SGG for training PredCls, it produces the following issue: TypeError:init() takes 3 positional arguments but 5 were given.
Hope to your reply. Thank you!
There is the whole issue txt:
Traceback (most recent call last): File "tools/relation_train_net.py", line 442, in
main()
File "tools/relation_train_net.py", line 435, in main
model = train(cfg, args.local_rank, args.distributed, logger)
File "tools/relation_train_net.py", line 48, in train
model = build_detection_model(cfg)
File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/detector/detectors.py", line 10, in build_detection_model
return meta_arch(cfg)
File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py", line 31, in init
self.roi_heads = build_roi_heads(cfg, self.backbone.out_channels)
File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/roi_heads.py", line 83, in build_roi_heads
roi_heads.append(("box", build_roi_box_head(cfg, in_channels)))
File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py", line 115, in build_roi_box_head
return ROIBoxHead(cfg, in_channels)
File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py", line 26, in init
self.feature_extractor = make_roi_box_feature_extractor(cfg, in_channels, half_out=self.cfg.MODEL.ATTRIBUTE_ON)
File "/home/yons/scene/VTSCN/SHA-GCL-for-SGG/maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_feature_extractors.py", line 166, in make_roi_box_feature_extractor
return func(cfg, in_channels, half_out, cat_all_levels)
TypeError: init() takes 3 positional arguments but 5 were given
Traceback (most recent call last):
File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/site-packages/torch/distributed/launch.py", line 260, in
main()
File "/home/yons/anaconda3/envs/VTSCN/lib/python3.8/site-packages/torch/distributed/launch.py", line 255, in main
raise subprocess.CalledProcessError(returncode=process.returncode,
subprocess.CalledProcessError: Command '['/home/yons/anaconda3/envs/VTSCN/bin/python', '-u', 'tools/relation_train_net.py', '--local_rank=0', '--config-file', 'configs/SHA_GCL_e2e_relation_X_101_32_8_FPN_1x.yaml', 'GLOBAL_SETTING.DATASET_CHOICE', 'VG', 'GLOBAL_SETTING.RELATION_PREDICTOR', 'TransLike_GCL', 'GLOBAL_SETTING.BASIC_ENCODER', 'Hybrid-Attention', 'GLOBAL_SETTING.GCL_SETTING.GROUP_SPLIT_MODE', 'divide4', 'GLOBAL_SETTING.GCL_SETTING.KNOWLEDGE_TRANSFER_MODE', 'KL_logit_TopDown', 'MODEL.ROI_RELATION_HEAD.USE_GT_BOX', 'True', 'MODEL.ROI_RELATION_HEAD.USE_GT_OBJECT_LABEL', 'True', 'SOLVER.IMS_PER_BATCH', '8', 'TEST.IMS_PER_BATCH', '8', 'DTYPE', 'float16', 'SOLVER.MAX_ITER', '60000', 'SOLVER.VAL_PERIOD', '5000', 'SOLVER.CHECKPOINT_PERIOD', '5000', 'GLOVE_DIR', '/home/yons/scene/VTSCN/datasets/vg/glove', 'OUTPUT_DIR', '/home/yons/scene/VTSCN/datasets/output/SHA_GCL_VG_PredCls_test']' returned non-zero exit status 1.