Maelic / SGG-Benchmark

A New Benchmark for Scene Graph Generation, targeting real-world applications
MIT License
36 stars 5 forks source link

Issue with Configuration and Runtime Error in webcam_demo.py #18

Open wangjanice8 opened 3 months ago

wangjanice8 commented 3 months ago

Hello,

First of all, thank you for your hard work on this project.

I am new to Scene Graph Generation (SGG) and have been trying to run the webcam_demo.py script. My configuration is as follows:

config: VG150/e2e_relation_yolov8m.yaml weights: VG150-penet-yolov8m/best_model_epoch_2.pth Firstly, I would like to confirm if this configuration is correct. Secondly, despite this configuration, I am encountering the following runtime error. Could you please guide me on how to resolve this issue? Thank you in advance. Traceback (most recent call last): File "/home/wangzixuan/real_time/SGG-Benchmark-main/demo/webcam_demo.py", line 77, in main(args) File "/home/wangzixuan/real_time/SGG-Benchmark-main/demo/webcam_demo.py", line 25, in main model = SGG_Model(config_path, dict_file, weights, tracking=tracking, rel_conf=rel_conf, box_conf=box_conf) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/wangzixuan/real_time/SGG-Benchmark-main/demo/demo_model.py", line 61, in init self.load_model() File "/home/wangzixuan/real_time/SGG-Benchmark-main/demo/demo_model.py", line 78, in load_model self.checkpointer.load(self.model_weights) # 直接加载检查点文件,不需要额外的变量接收返回值 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/utils/checkpoint.py", line 67, in load self._load_model(checkpoint, load_mapping, verbose) File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/utils/checkpoint.py", line 107, in _load_model load_state_dict(self.model, checkpoint.pop("model"), load_mapping, verbose) File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/utils/model_serialization.py", line 94, in load_state_dict model.load_state_dict(model_state_dict) File "/home/wangzixuan/anaconda3/envs/scene_graph_benchmark/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2153, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for GeneralizedYOLO: size mismatch for roi_heads.relation.predictor.post_emb.weight: copying a param with shape torch.Size([4096, 2048]) from checkpoint, the shape in current model is torch.Size([1024, 512]). size mismatch for roi_heads.relation.predictor.post_emb.bias: copying a param with shape torch.Size([4096]) from checkpoint, the shape in current model is torch.Size([1024]).

Maelic commented 3 months ago

Hi, this may be due to the config file used, please try to replace the config file with the one provided in VG150-penet-yolov8m, such as: --config-file VG150-penet-yolov8m/config.yml

wangjanice8 commented 3 months ago

Hi, this may be due to the config file used, please try to replace the config file with the one provided in VG150-penet-yolov8m, such as: --config-file VG150-penet-yolov8m/config.yml

Hi, Thank you for your helpful response! I have encountered another issue and would appreciate your assistance. While running relation_test_net.py with the following parameters: config_file = "/model/VG150-penet-yolov8m/config.yml" cfg.MODEL.WEIGHT = "/model/VG150-penet-yolov8m/best_model_epoch_2.pth" I encountered a mismatch problem, as shown in the log below: 2024-07-21 17:49:44.049 | DEBUG | sgg_benchmark.utils.model_serialization:align_and_update_state_dicts:56 - NO-MATCHING of current module: roi_heads.relation.predictor.context_layer.W_obj.layers.0.bias of shape (1024,) 2024-07-21 17:49:44.049 | DEBUG | sgg_benchmark.utils.model_serialization:align_and_update_state_dicts:56 - NO-MATCHING of current module: roi_heads.relation.predictor.context_layer.W_obj.layers.0.weight of shape (1024, 200) 2024-07-21 17:49:44.049 | DEBUG | sgg_benchmark.utils.model_serialization:align_and_update_state_dicts:56 - NO-MATCHING of current module: roi_heads.relation.predictor.context_layer.W_obj.layers.1.bias of shape (2048,) 2024-07-21 17:49:44.050 | DEBUG | sgg_benchmark.utils.model_serialization:align_and_update_state_dicts:56 - NO-MATCHING of current module: roi_heads.relation.predictor.context_layer.W_obj.layers.1.weight of shape (2048, 1024) ... Could you please advise on the cause of this issue and how to resolve it? Thank you!

Maelic commented 2 months ago

Hi @wangjanice8,

I have just pushed some changes that should solve your problem. The issue comes from a difference in the dimension of the MLP layers in penet. I refactor to the previous dim and now it should work.

wangjanice8 commented 2 months ago

Hi @wangjanice8,

I have just pushed some changes that should solve your problem. The issue comes from a difference in the dimension of the MLP layers in penet. I refactor to the previous dim and now it should work.

Hello! Thank you very much for your response and continuous updates. I encountered an issue while running relation_test_net.py. Here is the error traceback: Traceback (most recent call last): File "/home/wangzixuan/real_time/SGG-Benchmark-main/tools/relation_test_net.py", line 180, in main() File "/home/wangzixuan/real_time/SGG-Benchmark-main/tools/relation_test_net.py", line 118, in main inference( File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/engine/inference.py", line 331, in inference return evaluate(cfg=cfg, ^^^^^^^^^^^^^^^^^ File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/data/datasets/evaluation/init.py", line 27, in evaluate return vg_evaluation(**args) ^^^^^^^^^^^^^^^^^^^^^ File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/data/datasets/evaluation/vg/init.py", line 15, in vg_evaluation return do_vg_evaluation( ^^^^^^^^^^^^^^^^^ File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/data/datasets/evaluation/vg/vg_eval.py", line 66, in do_vg_evaluation gt = dataset.get_groundtruth(image_id, evaluation=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/wangzixuan/real_time/SGG-Benchmark-main/sgg_benchmark/data/datasets/visual_genome.py", line 241, in get_groundtruth target.add_field("informative_rels", self.informative_graphs[str(img_info['image_id'])])


KeyError: '2343729'

I have correctly downloaded the VG dataset. Could you please advise on how to resolve this issue?
Thank you very much.
Maelic commented 2 months ago

Yeah I don't know why some people are still having this issue because I don't have it. Basically you need to replace the str() by int() and it should work, here: https://github.com/Maelic/SGG-Benchmark/blob/4d396a394eb74079cf3ed041df927581c063f4da/sgg_benchmark/data/datasets/visual_genome.py#L241

Make ti like that: target.add_field("informative_rels", self.informative_graphs[int(img_info['image_id'])])

PengPaulWang commented 1 month ago

Hi, have you resolved the issue about dimension mismatch? I tried everything but still have the issues below?

========== !source activate sgg_benchmark && CUDA_VISIBLE_DEVICES=0 torchrun --master_port 10027 --nproc_per_node=1 tools/relation_test_net.py --config-file "./checkpoints/VG150-penet-yolov8m/config.yml" MODEL.ROI_RELATION_HEAD.USE_GT_BOX False MODEL.ROI_RELATION_HEAD.USE_GT_OBJECT_LABEL False MODEL.ROI_RELATION_HEAD.PREDICTOR CausalAnalysisPredictor MODEL.ROI_RELATION_HEAD.CAUSAL.EFFECT_TYPE TDE MODEL.ROI_RELATION_HEAD.CAUSAL.FUSION_TYPE sum MODEL.ROI_RELATION_HEAD.CAUSAL.CONTEXT_LAYER motifs TEST.IMS_PER_BATCH 1 DTYPE "float16" GLOVE_DIR ./glove MODEL.PRETRAINED_DETECTOR_CKPT ./checkpoints/VG150-penet-yolov8m OUTPUT_DIR ./checkpoints/VG150-penet-yolov8m TEST.CUSTUM_EVAL True TEST.CUSTUM_PATH ./checkpoints/pw_custom_images DETECTED_SGG_DIR ./checkpoints/pw_sgdet_custom_images_yolo_8m

====================

DATALOADER: ASPECT_RATIO_GROUPING: True NUM_WORKERS: 4 SIZE_DIVISIBILITY: 0 DATASETS: NAME: TEST: () TO_TEST: TRAIN: () VAL: () DETECTED_SGG_DIR: . DTYPE: float32 GLOVE_DIR: . INPUT: BRIGHTNESS: 0.0 CONTRAST: 0.0 FLIP_PROB_TRAIN: 0.5 HUE: 0.0 MAX_SIZE_TEST: 1333 MAX_SIZE_TRAIN: 1333 MIN_SIZE_TEST: 800 MIN_SIZE_TRAIN: 800 PADDING: False PIXEL_MEAN: [102.9801, 115.9465, 122.7717] PIXEL_STD: [1.0, 1.0, 1.0] SATURATION: 0.0 TO_BGR255: True VERTICAL_FLIP_PROB_TRAIN: 0.0 METRIC_TO_TRACK: mR MODEL: ATTRIBUTE_ON: False BACKBONE: EXTRA_CONFIG: FREEZE: False FREEZE_CONV_BODY_AT: 2 NMS_THRESH: 0.7 TYPE: R-50-C4 BOX_HEAD: True CLS_AGNOSTIC_BBOX_REG: False DEVICE: cuda FBNET: ARCH: default ARCH_DEF: BN_TYPE: bn DET_HEAD_BLOCKS: [] DET_HEAD_LAST_SCALE: 1.0 DET_HEAD_STRIDE: 0 DW_CONV_SKIP_BN: True DW_CONV_SKIP_RELU: True KPTS_HEAD_BLOCKS: [] KPTS_HEAD_LAST_SCALE: 0.0 KPTS_HEAD_STRIDE: 0 MASK_HEAD_BLOCKS: [] MASK_HEAD_LAST_SCALE: 0.0 MASK_HEAD_STRIDE: 0 RPN_BN_TYPE: RPN_HEAD_BLOCKS: 0 SCALE_FACTOR: 1.0 WIDTH_DIVISOR: 1 FLIP_AUG: False FPN: USE_GN: False USE_RELU: False GROUP_NORM: DIM_PER_GP: -1 EPSILON: 1e-05 NUM_GROUPS: 32 MASK_ON: False META_ARCHITECTURE: GeneralizedRCNN PRETRAINED_DETECTOR_CKPT: RELATION_ON: False RESNETS: BACKBONE_OUT_CHANNELS: 1024 DEFORMABLE_GROUPS: 1 NUM_GROUPS: 1 RES2_OUT_CHANNELS: 256 RES5_DILATION: 1 STAGE_WITH_DCN: (False, False, False, False) STEM_FUNC: StemWithFixedBatchNorm STEM_OUT_CHANNELS: 64 STRIDE_IN_1X1: True TRANS_FUNC: BottleneckWithFixedBatchNorm WIDTH_PER_GROUP: 64 WITH_MODULATED_DCN: False ROI_ATTRIBUTE_HEAD: ATTRIBUTE_BGFG_RATIO: 3 ATTRIBUTE_BGFG_SAMPLE: True ATTRIBUTE_LOSS_WEIGHT: 0.1 FEATURE_EXTRACTOR: FPN2MLPFeatureExtractor MAX_ATTRIBUTES: 10 NUM_ATTRIBUTES: 201 POS_WEIGHT: 5.0 PREDICTOR: FPNPredictor SHARE_BOX_FEATURE_EXTRACTOR: True USE_BINARY_LOSS: True ROI_BOX_HEAD: CONV_HEAD_DIM: 256 DILATION: 1 FEATURE_EXTRACTOR: ResNet50Conv5ROIFeatureExtractor MLP_HEAD_DIM: 2048 NUM_CLASSES: 151 NUM_STACKED_CONVS: 4 POOLER_RESOLUTION: 14 POOLER_SAMPLING_RATIO: 0 POOLER_SCALES: (0.0625,) PREDICTOR: FastRCNNPredictor USE_GN: False ROI_HEADS: BATCH_SIZE_PER_IMAGE: 256 BBOX_REG_WEIGHTS: (10.0, 10.0, 5.0, 5.0) BG_IOU_THRESHOLD: 0.3 DETECTIONS_PER_IMG: 100 FG_IOU_THRESHOLD: 0.5 NMS: 0.3 NMS_FILTER_DUPLICATES: False POSITIVE_FRACTION: 0.25 POST_NMS_PER_CLS_TOPN: 300 SCORE_THRESH: 0.01 ROI_MASK_HEAD: CONV_LAYERS: (256, 256, 256, 256) DILATION: 1 FEATURE_EXTRACTOR: ResNet50Conv5ROIFeatureExtractor MLP_HEAD_DIM: 1024 POOLER_RESOLUTION: 14 POOLER_SAMPLING_RATIO: 0 POOLER_SCALES: (0.0625,) POSTPROCESS_MASKS: False POSTPROCESS_MASKS_THRESHOLD: 0.5 PREDICTOR: MaskRCNNC4Predictor RESOLUTION: 14 SHARE_BOX_FEATURE_EXTRACTOR: True USE_GN: False ROI_RELATION_HEAD: ADD_GTBOX_TO_PROPOSAL_IN_TRAIN: False BATCH_SIZE_PER_IMAGE: 64 CAUSAL: CONTEXT_LAYER: motifs EFFECT_ANALYSIS: False EFFECT_TYPE: none FUSION_TYPE: sum SEPARATE_SPATIAL: False SPATIAL_FOR_VISION: False CLASSIFIER: linear CONTEXT_DROPOUT_RATE: 0.2 CONTEXT_HIDDEN_DIM: 512 CONTEXT_OBJ_LAYER: 1 CONTEXT_POOLING_DIM: 4096 CONTEXT_REL_LAYER: 1 EMBED_DIM: 200 FEATURE_EXTRACTOR: RelationFeatureExtractor LABEL_SMOOTHING_LOSS: False LOGIT_ADJUSTMENT: False LOGIT_ADJUSTMENT_TAU: 0.3 LOSS: CrossEntropyLoss MLP_HEAD_DIM: 2048 NUM_CLASSES: 51 NUM_SAMPLE_PER_GT_REL: 4 POOLING_ALL_LEVELS: True POSITIVE_FRACTION: 0.25 PREDICTOR: MotifPredictor PREDICT_USE_VISION: False REQUIRE_BOX_OVERLAP: True SQUAT_MODULE: BETA: 0.7 NUM_DECODER: 3 PRETRAIN_MASK: False PRETRAIN_MASK_EPOCH: 1 PRE_NORM: False RHO: 0.35 TEXTUAL_FEATURES_ONLY: False TRANSFORMER: DROPOUT_RATE: 0.1 INNER_DIM: 2048 KEY_DIM: 64 NUM_HEAD: 8 OBJ_LAYER: 4 REL_LAYER: 2 VAL_DIM: 64 USE_FREQUENCY_BIAS: False USE_GT_BOX: True USE_GT_OBJECT_LABEL: False USE_SPATIAL_FEATURES: True USE_UNION_FEATURES: True VISUAL_FEATURES_ONLY: False RPN: ANCHOR_SIZES: (32, 64, 128, 256, 512) ANCHOR_STRIDE: (16,) ASPECT_RATIOS: (0.5, 1.0, 2.0) BATCH_SIZE_PER_IMAGE: 256 BG_IOU_THRESHOLD: 0.3 FG_IOU_THRESHOLD: 0.7 FPN_POST_NMS_PER_BATCH: True FPN_POST_NMS_TOP_N_TEST: 2000 FPN_POST_NMS_TOP_N_TRAIN: 2000 MIN_SIZE: 0 POSITIVE_FRACTION: 0.5 POST_NMS_TOP_N_TEST: 1000 POST_NMS_TOP_N_TRAIN: 2000 PRE_NMS_TOP_N_TEST: 6000 PRE_NMS_TOP_N_TRAIN: 12000 RPN_HEAD: SingleConvRPNHead RPN_MID_CHANNEL: 512 STRADDLE_THRESH: 0 USE_FPN: False RPN_ONLY: False TEXT_EMBEDDING: glove.6B VGG: VGG16_OUT_CHANNELS: 512 WEIGHT: YOLO: IMG_SIZE: 640 OUT_CHANNELS: 256 SIZE: yolov8l WEIGHTS: OUTPUT_DIR: . PATHS_CATALOG: /content/gdrive/MyDrive/SGG-Benchmark/sgg_benchmark/config/paths_catalog.py PATHS_DATA: /content/gdrive/MyDrive/SGG-Benchmark/datasets/vg/ SEED: 42 SOLVER: BASE_LR: 0.001 BIAS_LR_FACTOR: 1 CHECKPOINT_PERIOD: 2500 CLIP_NORM: 5.0 GAMMA: 0.5 GRAD_NORM_CLIP: 5.0 IMS_PER_BATCH: 2 MAX_EPOCH: 100 MAX_ITER: 40000 MOMENTUM: 0.9 OPTIMIZER: SGD PRE_VAL: True PRINT_GRAD_FREQ: 5000 SCHEDULE: COOLDOWN: 1 FACTOR: 0.5 MAX_DECAY_STEP: 7 PATIENCE: 2 THRESHOLD: 0.0001 TYPE: WarmupMultiStepLR STEPS: (30000,) TO_VAL: True UPDATE_SCHEDULE_DURING_LOAD: False VAL_PERIOD: 2500 WARMUP_FACTOR: 0.3333333333333333 WARMUP_ITERS: 500 WARMUP_METHOD: linear WEIGHT_DECAY: 0.0005 WEIGHT_DECAY_BIAS: 0.0 TEST: ALLOW_LOAD_FROM_CACHE: True BBOX_AUG: ENABLED: False H_FLIP: False MAX_SIZE: 4000 SCALES: () SCALE_H_FLIP: False CUSTUM_EVAL: False CUSTUM_PATH: . DETECTIONS_PER_IMG: 100 EXPECTED_RESULTS: [] EXPECTED_RESULTS_SIGMA_TOL: 4 IMS_PER_BATCH: 2 INFORMATIVE: False RELATION: IOU_THRESHOLD: 0.5 LATER_NMS_PREDICTION_THRES: 0.3 MULTIPLE_PREDS: False REQUIRE_OVERLAP: True SYNC_GATHER: False SAVE_PROPOSALS: False TOP_K: 100 VERBOSE: INFO 2024-08-21 15:59:46.307 | INFO | sgg_benchmark.utils.logger:setup_logger:31 - Using loguru logger with level: INFO 2024-08-21 15:59:46.308 | INFO | main:main:51 - Using 1 GPUs 2024-08-21 15:59:46.308 | INFO | sgg_benchmark.utils.logger:logger_step:15 - #################### Step 1: Collecting environment info... #################### Overriding model.yaml nc=80 with nc=150 2024-08-21 15:59:46.990 | INFO | sgg_benchmark.data.build:get_dataset_statistics:30 - ---------------------------------------------------------------------------------------------------- 2024-08-21 15:59:46.991 | INFO | sgg_benchmark.data.build:get_dataset_statistics:31 - get dataset statistics... <class 'maskrcnn_benchmark.config.paths_catalog.DatasetCatalog'> ('VG150_train',) 2024-08-21 15:59:46.994 | INFO | sgg_benchmark.data.build:get_dataset_statistics:49 - Unable to load data statistics from: ./checkpoints/VG150-penet-yolov8m/VG150_train_statistics.cache ################################ VGDataset ++++++++++++++++++ in visual_genome.py self.filenames = 108073, self.img_info = 108073 2024-08-21 16:00:33.323 | INFO | sgg_benchmark.data.build:get_dataset_statistics:76 - Save data statistics to: ./checkpoints/VG150-penet-yolov8m/VG150_train_statistics.cache 2024-08-21 16:00:33.324 | INFO | sgg_benchmark.data.build:get_dataset_statistics:77 - ---------------------------------------------------------------------------------------------------- loading word vectors from ./glove/glove.6B.200d.pt 2024-08-21 16:01:29.097 | INFO | main:main:72 - Loading last checkpoint from /content/gdrive/MyDrive/SGG-Benchmark/checkpoints/VG150-penet-yolov8m/best_model_epoch_2.pth... 2024-08-21 16:01:29.098 | INFO | sgg_benchmark.utils.checkpoint:load:65 - Loading checkpoint from /content/gdrive/MyDrive/SGG-Benchmark/checkpoints/VG150-penet-yolov8m/best_model_epoch_2.pth Traceback (most recent call last): File "/content/gdrive/MyDrive/SGG-Benchmark/tools/relation_test_net.py", line 177, in main() File "/content/gdrive/MyDrive/SGG-Benchmark/tools/relation_testnet.py", line 73, in main = checkpointer.load(last_check) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/content/gdrive/MyDrive/SGG-Benchmark/sgg_benchmark/utils/checkpoint.py", line 67, in load self._load_model(checkpoint, load_mapping, verbose) File "/content/gdrive/MyDrive/SGG-Benchmark/sgg_benchmark/utils/checkpoint.py", line 107, in _load_model load_state_dict(self.model, checkpoint.pop("model"), load_mapping, verbose) File "/content/gdrive/MyDrive/SGG-Benchmark/sgg_benchmark/utils/model_serialization.py", line 94, in load_state_dict model.load_state_dict(model_state_dict) File "/usr/local/envs/sgg_benchmark/lib/python3.11/site-packages/torch/nn/modules/module.py", line 2153, in load_state_dict raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format( RuntimeError: Error(s) in loading state_dict for GeneralizedYOLO: size mismatch for roi_heads.relation.predictor.post_emb.weight: copying a param with shape torch.Size([4096, 2048]) from checkpoint, the shape in current model is torch.Size([1024, 512]). size mismatch for roi_heads.relation.predictor.post_emb.bias: copying a param with shape torch.Size([4096]) from checkpoint, the shape in current model is torch.Size([1024]). size mismatch for roi_heads.relation.union_feature_extractor.feature_extractor.pooler.reduce_channel.0.weight: copying a param with shape torch.Size([192, 576, 3, 3]) from checkpoint, the shape in current model is torch.Size([192, 192, 3, 3]). [2024-08-21 16:01:36,205] torch.distributed.elastic.multiprocessing.api: [ERROR] failed (exitcode: 1) local_rank: 0 (pid: 18546) of binary: /usr/local/envs/sgg_benchmark/bin/python Traceback (most recent call last): File "/usr/local/envs/sgg_benchmark/bin/torchrun", line 33, in sys.exit(load_entry_point('torch==2.2.1', 'console_scripts', 'torchrun')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/envs/sgg_benchmark/lib/python3.11/site-packages/torch/distributed/elastic/multiprocessing/errors/init.py", line 347, in wrapper return f(*args, **kwargs) ^^^^^^^^^^^^^^^^^^ File "/usr/local/envs/sgg_benchmark/lib/python3.11/site-packages/torch/distributed/run.py", line 812, in main run(args) File "/usr/local/envs/sgg_benchmark/lib/python3.11/site-packages/torch/distributed/run.py", line 803, in run elastic_launch( File "/usr/local/envs/sgg_benchmark/lib/python3.11/site-packages/torch/distributed/launcher/api.py", line 135, in call return launch_agent(self._config, self._entrypoint, list(args)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/envs/sgg_benchmark/lib/python3.11/site-packages/torch/distributed/launcher/api.py", line 268, in launch_agent raise ChildFailedError( torch.distributed.elastic.multiprocessing.errors.ChildFailedError:

tools/relation_test_net.py FAILED

Failures:

------------------------------------------------------------ Root Cause (first observed failure): [0]: time : 2024-08-21_16:01:36 host : 53f493870382 rank : 0 (local_rank: 0) exitcode : 1 (pid: 18546) error_file: traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html ============================================================
wangjanice8 commented 1 month ago

Yeah I don't know why some people are still having this issue because I don't have it. Basically you need to replace the str() by int() and it should work, here:

https://github.com/Maelic/SGG-Benchmark/blob/4d396a394eb74079cf3ed041df927581c063f4da/sgg_benchmark/data/datasets/visual_genome.py#L241

Make ti like that: target.add_field("informative_rels", self.informative_graphs[int(img_info['image_id'])])

Thank you so much for your previous responses! I am currently working with the yolo-v8-penet network and have successfully completed training and testing using relation_train_net.py and relation_test_net.py. Now, I want to visualize the results using visualize_SGDet.ipynb, but I've run into a problem.

Specifically, I can't find the eval_results.pytorch and visual_info.json files. I'm unsure how these files are generated. I've checked the documentation and relevant scripts but haven't found clear steps to produce these files.

I would greatly appreciate any guidance or advice!

Maelic commented 1 month ago

Hi, don't use the visualize_SGDet.ipynb notebook for inference it is outdated (I forgot to remove it). Use this one instead: https://github.com/Maelic/SGG-Benchmark/blob/main/demo/SGDET_on_cutom_images.ipynb

You can also try the webcam demo if you want in the same folder: https://github.com/Maelic/SGG-Benchmark/tree/main/demo

Young-Loser commented 1 week ago

是的,我不知道为什么有些人仍然遇到这个问题,因为我没有遇到过。基本上,您需要将 str() 替换为 int(),它应该可以正常工作,如下所示: https://github.com/Maelic/SGG-Benchmark/blob/4d396a394eb74079cf3ed041df927581c063f4da/sgg_benchmark/data/datasets/visual_genome.py#L241

让它像这样:target.add_field("informative_rels", self.informative_graphs[int(img_info['image_id'])])

非常感谢您之前的回复! 我目前正在使用 yolo-v8-penet 网络,并已使用 relation_train_net.py 和 relation_test_net.py 成功完成训练和测试。现在,我想使用 visualize_SGDet.ipynb 将结果可视化,但遇到了一个问题。

具体来说,我找不到 eval_results.pytorch 和 visual_info.json 文件。我不确定这些文件是如何生成的。 我检查了文档和相关脚本,但没有找到生成这些文件的明确步骤。

我将非常感谢任何指导或建议!

您好!看您的回复,我觉得您应该是中国人,我有一些关于这个项目复现的问题想向您请教,我也是sgg初学者,不知道能否和您进行交流。我的邮箱是1339241893@qq.com,我的微信是:XC-992997,期待得到您的回复,希望与您进行交流学习!