KaihuaTang / Scene-Graph-Benchmark.pytorch

A new codebase for popular Scene Graph Generation methods (2020). Visualization & Scene Graph Extraction on custom images/datasets are provided. It's also a PyTorch implementation of paper “Unbiased Scene Graph Generation from Biased Training CVPR 2020”
MIT License
1.03k stars 228 forks source link

AssertionError #158

Open kingdomrush2 opened 2 years ago

kingdomrush2 commented 2 years ago

❓ Questions and Help

when I test on sgdet mission,the model is train on ag dataset by myself, I find an error, how to solve it, thanks! the error details is below

Versions of relevant libraries: [pip3] numpy==1.21.2 [pip3] torch==1.8.0 [pip3] torchaudio==0.8.0 [pip3] torchvision==0.9.0 [conda] blas 1.0 mkl defaults [conda] cudatoolkit 11.1.1 heb2d755_9 conda-forge [conda] mkl 2021.4.0 haa95532_640 defaults [conda] mkl-service 2.4.0 py37h2bbff1b_0 defaults [conda] mkl_fft 1.3.1 py37h277e83a_0 defaults [conda] mkl_random 1.2.2 py37hf11a4ad_0 defaults [conda] numpy 1.21.2 py37hfca59bb_0 defaults [conda] numpy-base 1.21.2 py37h0829f74_0 defaults [conda] pytorch 1.8.0 py3.7_cuda11.1_cudnn8_0 pytorch [conda] torchaudio 0.8.0 py37 pytorch [conda] torchvision 0.9.0 py37_cu111 pytorch Pillow (8.4.0) 2021-12-26 11:22:57,073 maskrcnn_benchmark.data.build INFO: ---------------------------------------------------------------------------------------------------- 2021-12-26 11:22:57,073 maskrcnn_benchmark.data.build INFO: get dataset statistics... 2021-12-26 11:22:57,075 maskrcnn_benchmark.data.build INFO: Loading data statistics from: /home/kaihua/checkpoints/motif-precls-exmp\VG_stanford_filtered_with_attribute_train_statistics.c ache 2021-12-26 11:22:57,075 maskrcnn_benchmark.data.build INFO: ---------------------------------------------------------------------------------------------------- 37 27 37 27 loading word vectors from /home/kaihua/glove\glove.6B.200d.pt background -> background fail on background loading word vectors from /home/kaihua/glove\glove.6B.200d.pt background -> background fail on background Warning: multi_tensor_applier fused unscale kernel is unavailable, possibly because apex was installed without --cuda_ext --cpp_ext. Using Python fallback. Original ImportError was: Mod uleNotFoundError("No module named 'amp_C'") 2021-12-26 11:23:01,669 maskrcnn_benchmark.utils.checkpoint INFO: Loading checkpoint from /home/kaihua/checkpoints/motif-precls-exmp/model_final.pth


=====> /home/kaihua/checkpoints/result\custom_data_info.json SAVED !
2021-12-26 11:23:03,615 maskrcnn_benchmark.inference INFO: Start evaluation on VG_stanford_filtered_with_attribute_test dataset(8 images).
  0%|                                                                                                                                                               | 0/8 [00:02<?, ?it/s]
Traceback (most recent call last):
  File "tools/relation_test_net.py", line 112, in <module>
    main()
  File "tools/relation_test_net.py", line 106, in main
    output_folder=output_folder,
  File "d:\home\scene-graph-benchmark.pytorch-master\maskrcnn_benchmark\engine\inference.py", line 110, in inference
    predictions = compute_on_dataset(model, data_loader, device, synchronize_gather=cfg.TEST.RELATION.SYNC_GATHER, timer=inference_timer)
  File "d:\home\scene-graph-benchmark.pytorch-master\maskrcnn_benchmark\engine\inference.py", line 34, in compute_on_dataset
    output = model(images.to(device), targets)
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "d:\home\scene-graph-benchmark.pytorch-master\maskrcnn_benchmark\modeling\detector\generalized_rcnn.py", line 52, in forward
    x, result, detector_losses = self.roi_heads(features, proposals, targets, logger)
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "d:\home\scene-graph-benchmark.pytorch-master\maskrcnn_benchmark\modeling\roi_heads\roi_heads.py", line 27, in forward
    x, detections, loss_box = self.box(features, proposals, targets)
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "d:\home\scene-graph-benchmark.pytorch-master\maskrcnn_benchmark\modeling\roi_heads\box_head\box_head.py", line 69, in forward
    x = self.feature_extractor(features, proposals)
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "d:\home\scene-graph-benchmark.pytorch-master\maskrcnn_benchmark\modeling\roi_heads\box_head\roi_box_feature_extractors.py", line 84, in forward
    x = self.pooler(x, proposals)
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\nn\modules\module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "d:\home\scene-graph-benchmark.pytorch-master\maskrcnn_benchmark\modeling\poolers.py", line 109, in forward
    assert rois.size(0) > 0
AssertionError
Killing subprocess 3528
Traceback (most recent call last):
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\distributed\launch.py", line 340, in <module>
    main()
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\distributed\launch.py", line 326, in main
    sigkill_handler(signal.SIGTERM, None)  # not coming back
  File "D:\Anaconda\envs\scene_graph_benchmark2\lib\site-packages\torch\distributed\launch.py", line 301, in sigkill_handler
    raise subprocess.CalledProcessError(returncode=last_return_code, cmd=cmd)
missyoudaisy commented 3 months ago

Did you solve the problem? I also meet the problem assert rois.size(0) > 0. And I found that image 2389060.jpg only have one ground truth bounding box, thus the predcls task fails.