hasanirtiza / Pedestron

[Pedestron] Generalizable Pedestrian Detection: The Elephant In The Room. @ CVPR2021
https://openaccess.thecvf.com/content/CVPR2021/papers/Hasan_Generalizable_Pedestrian_Detection_The_Elephant_in_the_Room_CVPR_2021_paper.pdf
Apache License 2.0
687 stars 159 forks source link

CSP weight is corrupted #139

Closed yeojinyeojin closed 2 years ago

yeojinyeojin commented 2 years ago

I'm using Docker to run the app. Demo works just fine with a model I found on issues report (https://drive.google.com/file/d/12mWjmWBv-4wra8hCNF71Wq0U2va0Ai8e/view) but using CSP model that I downloaded from README gives the following error:

root@d451ddbe129b:/pedestron# python tools/demo.py --config configs/elephant/cityperson/csp_r50.py --checkpoint ./models_pretrained/csp_r50_epoch_72.pth.stu --input_img_dir /data
/data
['/data/image.jpg', '/data/image2.jpg', '/data/image3.jpg', '/data/image4.jpg', '/data/image5.jpg', '/data/image6.jpg', '/data/image7.jpg', '/data/image8.jpg']
Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/tarfile.py", line 2297, in next
    tarinfo = self.tarinfo.fromtarfile(self)
  File "/opt/conda/lib/python3.6/tarfile.py", line 1093, in fromtarfile
    obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors)
  File "/opt/conda/lib/python3.6/tarfile.py", line 1029, in frombuf
    raise EmptyHeaderError("empty header")
tarfile.EmptyHeaderError: empty header

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 595, in _load
    return legacy_load(f)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 506, in legacy_load
    with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \
  File "/opt/conda/lib/python3.6/tarfile.py", line 1589, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/opt/conda/lib/python3.6/tarfile.py", line 1619, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/opt/conda/lib/python3.6/tarfile.py", line 1482, in __init__
    self.firstmember = self.next()
  File "/opt/conda/lib/python3.6/tarfile.py", line 2312, in next
    raise ReadError("empty file")
tarfile.ReadError: empty file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "tools/demo.py", line 83, in <module>
    run_detector_on_dataset()
  File "tools/demo.py", line 65, in run_detector_on_dataset
    args.config, args.checkpoint, device=torch.device('cuda:0'))
  File "/pedestron/tools/../mmdet/apis/inference.py", line 40, in init_detector
    checkpoint = load_checkpoint(model, checkpoint)
  File "/opt/conda/lib/python3.6/site-packages/mmcv/runner/checkpoint.py", line 146, in load_checkpoint
    checkpoint = torch.load(filename, map_location=map_location)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 426, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 597, in _load
    if _is_zipfile(f):
  File "/opt/conda/lib/python3.6/site-packages/torch/serialization.py", line 75, in _is_zipfile
    if ord(magic_byte) != ord(read_byte):
TypeError: ord() expected a character, but string of length 0 found
hasanirtiza commented 2 years ago

@yeojinyeojin Most probably the weights are corrupted. Unfortunately, none of the co-authors have access to the pre-trained model. The best way is to train it yourself the csp or use the original keras implementation