zhangce01 / HiKER-SGG

[CVPR 2024] Code for HiKER-SGG: Hierarchical Knowledge Enhanced Robust Scene Graph Generation
https://zhangce01.github.io/HiKER-SGG/
MIT License
58 stars 2 forks source link

FileNotFoundError: [Errno 2] No such file or directory: '/home/ce/data/vg/conf_mat_freq_train.npy' #2

Closed Nyeilim closed 6 months ago

Nyeilim commented 6 months ago

I run the hikersgg_predcls_train.ipynb and encouter this problem; Full input and error output is below:

# Input Block
detector = KERN(classes=train.ind_to_classes, rel_classes=train.ind_to_predicates,
                num_gpus=conf.num_gpus, mode=conf.mode, require_overlap_det=True,
                use_resnet=conf.use_resnet, use_proposals=conf.use_proposals, pooling_dim=conf.pooling_dim,
                ggnn_rel_time_step_num=3, ggnn_rel_hidden_dim=1024, ggnn_rel_output_dim=None,
                graph_path=os.path.join(codebase, 'graphs/005/all_edges_with_sccluster2_pred_ent.pkl'),
                emb_path=os.path.join(codebase, 'graphs/001/emb_mtx_with_sccluster2_pred_ent.pkl'),
                rel_counts_path=os.path.join(codebase, 'graphs/001/pred_counts.pkl'),
                use_knowledge=True, use_embedding=True, refine_obj_cls=False,
                class_volume=1.0, with_clean_classifier=True, with_transfer=True, sa=True, config=conf,
                )
# Error Output
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[13], line 1
----> 1 detector = KERN(classes=train.ind_to_classes, rel_classes=train.ind_to_predicates,
      2                 num_gpus=conf.num_gpus, mode=conf.mode, require_overlap_det=True,
      3                 use_resnet=conf.use_resnet, use_proposals=conf.use_proposals, pooling_dim=conf.pooling_dim,
      4                 ggnn_rel_time_step_num=3, ggnn_rel_hidden_dim=1024, ggnn_rel_output_dim=None,
      5                 graph_path=os.path.join(codebase, 'graphs/005/all_edges_with_sccluster2_pred_ent.pkl'),
      6                 emb_path=os.path.join(codebase, 'graphs/001/emb_mtx_with_sccluster2_pred_ent.pkl'),
      7                 rel_counts_path=os.path.join(codebase, 'graphs/001/pred_counts.pkl'),
      8                 use_knowledge=True, use_embedding=True, refine_obj_cls=False,
      9                 class_volume=1.0, with_clean_classifier=True, with_transfer=True, sa=True, config=conf,
     10                 )

File /output/HiKER-SGG/lib/my_model_24.py:182, in KERN.__init__(self, classes, rel_classes, graph_path, emb_path, mode, num_gpus, require_overlap_det, pooling_dim, use_resnet, thresh, use_proposals, ggnn_rel_time_step_num, ggnn_rel_hidden_dim, ggnn_rel_output_dim, use_knowledge, use_embedding, refine_obj_cls, rel_counts_path, class_volume, with_clean_classifier, with_transfer, sa, config)
    179     self.roi_fmap = Sequential(*roi_fmap)
    180     self.roi_fmap_obj = load_vgg(pretrained=False).classifier
--> 182 self.ggnn_rel_reason = GGNNRelReason(mode=self.mode,
    183                                      num_obj_cls=len(self.classes),
    184                                      num_rel_cls=len(rel_classes),
    185                                      obj_dim=self.obj_dim,
    186                                      rel_dim=self.rel_dim,
    187                                      time_step_num=ggnn_rel_time_step_num,
    188                                      hidden_dim=ggnn_rel_hidden_dim,
    189                                      output_dim=ggnn_rel_output_dim,
    190                                      emb_path=emb_path,
    191                                      graph_path=graph_path,
    192                                      refine_obj_cls=refine_obj_cls,
    193                                      use_knowledge=use_knowledge,
    194                                      use_embedding=use_embedding,
    195                                      with_clean_classifier=with_clean_classifier,
    196                                      with_transfer=with_transfer,
    197                                      sa=sa,
    198                                      config=config,
    199                                      )
    201 if rel_counts_path is not None:
    202     with open(rel_counts_path, 'rb') as fin:

File /output/HiKER-SGG/lib/my_model_24.py:53, in GGNNRelReason.__init__(self, graph_path, emb_path, mode, num_obj_cls, num_rel_cls, obj_dim, rel_dim, time_step_num, hidden_dim, output_dim, use_knowledge, use_embedding, refine_obj_cls, with_clean_classifier, with_transfer, sa, config)
     49 self.rel_proj = Linear(self.rel_dim, hidden_dim)
     51 assert not (refine_obj_cls and mode == 'predcls')
---> 53 self.ggnn = GGNN(time_step_num=time_step_num, hidden_dim=hidden_dim, output_dim=output_dim,
     54                  emb_path=emb_path, graph_path=graph_path, refine_obj_cls=refine_obj_cls,
     55                  use_knowledge=use_knowledge, use_embedding=use_embedding, config=config, with_clean_classifier=with_clean_classifier, with_transfer=with_transfer, sa=sa, num_obj_cls=num_obj_cls, num_rel_cls=num_rel_cls)

File /output/HiKER-SGG/lib/my_ggnn_10.py:193, in GGNN.__init__(self, emb_path, graph_path, time_step_num, hidden_dim, output_dim, use_embedding, use_knowledge, refine_obj_cls, num_ents, num_preds, config, with_clean_classifier, with_transfer, num_obj_cls, num_rel_cls, sa, lrga)
    191 if self.with_transfer is True:
    192     print("!!!!!!!!!With Confusion Matrix Channel!!!!!")
--> 193     pred_adj_np = np.load(config.MODEL.CONF_MAT_FREQ_TRAIN)
    194     # pred_adj_np = 1.0 - pred_adj_np
    195     pred_adj_np[0, :] = 0.0

File /output/hiker-sgg/lib/python3.8/site-packages/numpy/lib/npyio.py:405, in load(file, mmap_mode, allow_pickle, fix_imports, encoding, max_header_size)
    403     own_fid = False
    404 else:
--> 405     fid = stack.enter_context(open(os_fspath(file), "rb"))
    406     own_fid = True
    408 # Code to distinguish from NumPy binary files and pickles.

FileNotFoundError: [Errno 2] No such file or directory: '/home/ce/data/vg/conf_mat_freq_train.npy'

It seems that a file called "conf_mat_freq_train.npy" is missed while constructing the GGNN; I have tried these means below:

  1. create a empty file in specific dir, didnt work.
  2. search the file in linux by find / -n, not found.
  3. search the file and its alis CONF_MAT_FREQ_TRAIN in your repo and KERN's, not found the saved code or direct file.

Please help me, I really dont know where the file is generated.

zhangce01 commented 6 months ago

Thank you for your interest in our work and for notifying me of the error in the code.

I forgot to include this file in this repo since it is in a separate data path and sorry for the inconvenience. conf_mat_freq_train.npy is the predicate confusion matrix generated by the MotifNet (as mentioned in Section 3.7). You can download it at SGG-G2S repo. I have also uploaded this file in this repo.

If you have any further questions about the paper or need assistance with the code, please feel free to reach out.