huanghoujing / EANet

EANet: Enhancing Alignment for Cross-Domain Person Re-identification
399 stars 88 forks source link

i am rookie and encounter ValueError: need more than 0 values to unpack #3

Closed Mdahao closed 5 years ago

Mdahao commented 5 years ago

Traceback (most recent call last): File "/home/ff/anaconda3/envs/python27/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/home/ff/anaconda3/envs/python27/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/ff/桌面/EANet-master/package/optim/eanet_trainer.py", line 131, in trainer = EANetTrainer() File "package/optim/reid_trainer.py", line 49, in init self.init_eval() File "package/optim/reid_trainer.py", line 109, in init_eval self.create_test_loaders() File "package/optim/reid_trainer.py", line 154, in create_test_loaders 'query': self.create_dataloader(mode='test', name=name, split=q_split), File "package/optim/reid_trainer.py", line 145, in create_dataloader dataloader = create_dataloader(deepcopy(cfg.dataloader), deepcopy(cfg.dataset), samples=samples) File "package/data/dataloader.py", line 8, in create_dataloader dataset = create_dataset(dataset_cfg, samples=samples) File "package/data/create_dataset.py", line 35, in create_dataset return factory[cfg.name](cfg, samples=samples) File "package/data/dataset.py", line 24, in init__ self.samples = self.load_split() File "package/data/dataset.py", line 53, in load_split self.save_split(self.split_spec[cfg.split], save_path) File "package/data/datasets/market1501.py", line 46, in save_split ids, cams = zip(*[self.parse_im_path(p) for p in im_paths]) ValueError: need more than 0 values to unpack

huanghoujing commented 5 years ago

Back-tracing the error, zip(*[self.parse_im_path(p) for p in im_paths]) is an empty list, thus im_paths is also an empty list, then im_paths = sorted(get_files_by_pattern(self.root, pattern=spec['pattern'], strip_root=True)) gives an empty list, which indicates mistakes in dataset path. Do you place the Market1501 dataset as described in README?

Mdahao commented 5 years ago

Back-tracing the error, zip(*[self.parse_im_path(p) for p in im_paths]) is an empty list, thus im_paths is also an empty list, then im_paths = sorted(get_files_by_pattern(self.root, pattern=spec['pattern'], strip_root=True)) gives an empty list, which indicates mistakes in dataset path. Do you place the Market1501 dataset as described in README?

yes I place the Market1501 dataset as described in README, but still occur this the error

huanghoujing commented 5 years ago

Can you run the following commands and post the results, so that I can find if it's the problem of dataset path. cd PROJECT_DIR means entering the project directory, which you should modify to your path.

cd PROJECT_DIR
ls -al
cd dataset
ls -al
cd dataset/market1501
ls -al
cd dataset/market1501/Market-1501-v15.09.15
ls -al
Mdahao commented 5 years ago

Can you run the following commands and post the results, so that I can find if it's the problem of dataset path. cd PROJECT_DIR means entering the project directory, which you should modify to your path.

cd PROJECT_DIR
ls -al
cd dataset
ls -al
cd dataset/market1501
ls -al
cd dataset/market1501/Market-1501-v15.09.15
ls -al

First ,I truly appreciate your timely help! and results are: ff@ff-System-Product-Name:~/桌面/EANet-master$ ls -al 总用量 56 drwxrwxr-x 8 ff ff 4096 1月 13 14:17 . drwxr-xr-x 3 ff ff 4096 1月 12 09:02 .. drwxrwxrwx 9 ff ff 4096 1月 13 14:21 dataset drwxrwxrwx 4 ff ff 4096 1月 13 10:19 exp -rw-rw-r-- 1 ff ff 75 1月 3 23:31 .gitignore drwxrwxrwx 2 ff ff 4096 1月 3 23:31 misc drwxrwxrwx 10 ff ff 4096 1月 13 10:18 package drwxrwxrwx 2 ff ff 4096 1月 3 23:31 paper_configs -rwxrwxrwx 1 ff ff 13674 1月 3 23:31 README.md -rwxrwxrwx 1 ff ff 162 1月 3 23:31 requirements.txt drwxrwxrwx 3 ff ff 4096 1月 3 23:31 script

ff@ff-System-Product-Name:~/桌面/EANet-master/dataset$ ls -al 总用量 36 drwxrwxrwx 9 ff ff 4096 1月 13 14:21 . drwxrwxr-x 8 ff ff 4096 1月 13 14:17 .. drwxrwxrwx 4 ff ff 4096 1月 13 14:19 coco drwxrwxrwx 4 ff ff 4096 1月 13 14:18 cuhk03_np_detected_jpg drwxrwxrwx 5 ff ff 4096 1月 13 14:21 duke drwxrwxrwx 5 ff ff 4096 1月 13 14:19 market1501 drwxrwxrwx 4 ff ff 4096 1月 13 14:21 msmt17 drwxrwxrwx 3 ff ff 4096 1月 13 14:05 partial_ilids drwxrwxrwx 3 ff ff 4096 1月 13 14:04 partial_reid

ff@ff-System-Product-Name:~/桌面/EANet-master/dataset/market1501$ ls -al 总用量 31736 drwxrwxrwx 5 ff ff 4096 1月 13 14:19 . drwxrwxrwx 9 ff ff 4096 1月 13 14:21 .. drwxrwxrwx 2 ff ff 585728 12月 7 22:07 bounding_box_train_duke_style -rwxrwxrwx 1 ff ff 31891931 1月 9 17:25 im_path_to_kpt.pkl drwxrwxrwx 7 ff ff 4096 9月 15 2015 Market-1501-v15.09.15 drwxrwxrwx 6 ff ff 4096 11月 4 20:14 Market-1501-v15.09.15_ps_label

ff@ff-System-Product-Name:~/桌面/EANet-master/dataset/market1501/Market-1501-v159.15$ ls -al 总用量 3128 drwxrwxrwx 7 ff ff 4096 9月 15 2015 . drwxrwxrwx 5 ff ff 4096 1月 13 14:19 .. drwxrwxrwx 2 ff ff 962560 1月 20 2014 bounding_box_test drwxrwxrwx 2 ff ff 585728 10月 10 2013 bounding_box_train drwxrwxrwx 2 ff ff 1142784 1月 20 2014 gt_bbox drwxrwxrwx 2 ff ff 360448 1月 20 2014 gt_query drwxrwxrwx 2 ff ff 139264 1月 20 2014 query -rwxrwxrwx 1 ff ff 2229 1月 21 2014 readme.txt

huanghoujing commented 5 years ago

I find something curious.

Mdahao commented 5 years ago

I find something curious.

* Your path `~/桌面/EANet-master/dataset/market1501/Market-1501-v159.15` is not correct. The `Market-1501-v159.15` should be `Market-1501-v15.09.15`.

* You can go to the project dir, and then run
  ```shell
  ls -al dataset/market1501/Market-1501-v15.09.15/bounding_box_train | wc -l
  ```

  it should give the result `12940`.

very sorry ,I did not copy it well. but my path is correct . result is 12940

xjhjinhui commented 5 years ago

@huanghoujing I met this error too, Traceback (most recent call last): File "/home/tay/anaconda2/envs/torch1/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/home/tay/anaconda2/envs/torch1/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/home/tay/EANet/package/optim/eanet_trainer.py", line 131, in <module> trainer = EANetTrainer() File "package/optim/reid_trainer.py", line 49, in __init__ self.init_eval() File "package/optim/reid_trainer.py", line 109, in init_eval self.create_test_loaders() File "package/optim/reid_trainer.py", line 154, in create_test_loaders 'query': self.create_dataloader(mode='test', name=name, split=q_split), File "package/optim/reid_trainer.py", line 145, in create_dataloader dataloader = create_dataloader(deepcopy(cfg.dataloader), deepcopy(cfg.dataset), samples=samples) File "package/data/dataloader.py", line 8, in create_dataloader dataset = create_dataset(dataset_cfg, samples=samples) File "package/data/create_dataset.py", line 35, in create_dataset return __factory[cfg.name](cfg, samples=samples) File "package/data/datasets/cuhk03_np_detected_jpg.py", line 25, in __init__ super(CUHK03NpDetectedJpg, self).__init__(cfg, samples=samples) File "package/data/dataset.py", line 24, in __init__ self.samples = self.load_split() File "package/data/dataset.py", line 53, in load_split self.save_split(self.split_spec[cfg.split], save_path) File "package/data/datasets/market1501.py", line 46, in save_split ids, cams = zip(*[self.parse_im_path(p) for p in im_paths]) ValueError: need more than 0 values to unpack and my path is correct: 总用量 3096 drwx------ 7 tay tay 4096 1月 8 21:21 . drwxrwxr-x 5 tay tay 4096 1月 9 09:59 .. drwx------ 2 tay tay 946176 1月 8 21:18 bounding_box_test drwx------ 2 tay tay 577536 1月 8 21:18 bounding_box_train drwx------ 2 tay tay 1118208 1月 8 21:21 gt_bbox drwx------ 2 tay tay 356352 1月 8 21:21 gt_query drwx------ 2 tay tay 143360 1月 8 21:21 query -rw-rw-r-- 1 tay tay 2229 1月 21 2014 readme.txt (torch1) tay@tay-To-be-filled-by-O-E-M:~/EANet/dataset/market1501/Market-1501-v15.09.15$ ls -al bounding_box_train | wc -l 12940

SWRDFK commented 5 years ago

@mypython3 @xjhjinhui Just like what author said before, we should place the Market1501 dataset as described in README. For example, we have to place THESE ALL("Market-1501-v15.09.15", "Market-1501-v15.09.15_ps_label", "bounding_box_train_duke_style" and "im_path_to_kpt.pkl") under the dictionary "dataset/market1501/". If not, it can't run successfully.

Dataset Structure in README: default

Running Show: default

huanghoujing commented 5 years ago

@mypython3 In your provided information, it seems not the problem of dataset path. However, the code runs well on my machine, so I could not help with your case.

@SWRDFK Thanks for your sharing.

huanghoujing commented 5 years ago

@mypython3 @xjhjinhui One thing occurs to me. Do you run the command right under the project directory?

For example, you have to enter the project directory before running the following command

CUDA_VISIBLE_DEVICES=0 python -m package.optim.eanet_trainer --exp_dir exp/eanet/GlobalPool/market1501 --cfg_file package/config/default.py --ow_file paper_configs/GlobalPool.txt --ow_str "cfg.dataset.train.name = 'market1501'"
Mdahao commented 5 years ago

@huanghoujing yes.

Mdahao commented 5 years ago

@huanghoujing I solved it.I downloaded the dataset again.maybe i meet some problem,when i downloaded the dataset. thank you for your help!

xjhjinhui commented 5 years ago

@huanghoujing Thanks for your excellent project!I find my mistake:when I ran the program first time because of some matters I didn't wait for it to finish,so that some pictures didn't change into jpg files.

huanghoujing commented 5 years ago

I am glad you have solved it. I will add some assertion code in the future.