报错信息:
Creating new split for detected images (767/700) ...
Traceback (most recent call last):
File "/root/diskb/ev_reid_dev_deploy/ev_reid_deploy/reid/reid_model_test.py", line 16, in <module>
batch_size_test=100
File "/root/diskb/ev_reid_dev_deploy/ev_reid_deploy/reid/torchreid/data/datamanager.py", line 205, in __init__
market1501_500k=market1501_500k
File "/root/diskb/ev_reid_dev_deploy/ev_reid_deploy/reid/torchreid/data/datasets/__init__.py", line 40, in init_image_dataset
return __image_datasets[name](**kwargs)
File "/root/diskb/ev_reid_dev_deploy/ev_reid_deploy/reid/torchreid/data/datasets/image/cuhk03.py", line 71, in __init__
self.preprocess_split()
File "/root/diskb/ev_reid_dev_deploy/ev_reid_deploy/reid/torchreid/data/datasets/image/cuhk03.py", line 273, in preprocess_split
loadmat(self.split_new_det_mat_path), self.imgs_detected_dir
File "/root/anaconda3/lib/python3.7/site-packages/scipy/io/matlab/mio.py", line 223, in loadmat
MR, _ = mat_reader_factory(f, **kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/scipy/io/matlab/mio.py", line 72, in mat_reader_factory
mjv, mnv = get_matfile_version(byte_stream)
File "/root/anaconda3/lib/python3.7/site-packages/scipy/io/matlab/miobase.py", line 231, in get_matfile_version
raise ValueError('Unknown mat file type, version %s, %s' % ret)
ValueError: Unknown mat file type, version 109, 101
然后我查询了很久为什么是mat格式错误,包括109 101的含义,都无果。
在github官方issue上直接查找Unknown mat file type是没有答案的。
搜索cuhk03时发现了这个issue
cuhk03.py loadmat func?
https://github.com/KaiyangZhou/deep-person-reid/issues/120
仔细看了一下,尝试解决了问题。
我之前是在这个页面右键下载的mat文件,https://github.com/zhunzhong07/person-re-ranking/tree/master/evaluation/data/CUHK03。发现文件有错误,文件大小和直接下载或clone该git的是不一致的。
于是我直接下载了该git的zip包,从中拷贝了下面两个文件
cuhk03_new_protocol_config_detected.mat
cuhk03_new_protocol_config_labeled.mat
覆盖旧的文件后,程序正确执行。