VlSomers / bpbreid

[WACV23] A strong baseline for body part-based person re-identification
Other
166 stars 16 forks source link

tensors is empty when use part_base_engine _feature_extraction #10

Closed MinhLe2512 closed 1 year ago

MinhLe2512 commented 1 year ago

So I had this error : TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

when trying to run this script :"python scripts/main.py --config-file configs/bpbreid/bpbreid_market1501_test.yaml". And I tried to fix it by downloading the dataset from drive and set the directories as in your instruction image After that, everything runs just fine until it comes to _feature_extraction at part_based_engine.py and I'm not sure if data_loader is null or not(I'm totally new to Python) but the for loop isn't running at all. "RuntimeError: torch.cat(): expected a non-empty list of Tensors". I would appreciate if you could guide me a little bit.

VlSomers commented 1 year ago

Hi, are all you directory non empty? I guess this happen because the "data_loader" in "_feature_extraction" is empty (can you verify that?). Can you check in "torchreid/data/datasets/image/market1501.py", where the dataset is loaded, if "train", "query" and "gallery" in "init" are non empty?

MinhLe2512 commented 1 year ago

Yes all the directories are non empty image. But apparently the train query and gallery is empty image

VlSomers commented 1 year ago

Then there's an issue with you path specification, can you check if self.train_dir, self.query_dir, self.galery_dir match your directory path on disk?

MinhLe2512 commented 1 year ago

Well they match but instead of having only one "\" the dir has 2 is it wrong or it's just how path works in python

F:\ReID\bpbreid\reid-data\Market-1501-v15.09.15\bounding_box_test

image

VlSomers commented 1 year ago

I'm not sure what's happening if the path is correct, I'm sorry, but at least you found the root cause for the error: now you should figure out why the dataset is not located properly (it should definitely be an issue with your path or Windows related stuff)

MinhLe2512 commented 1 year ago

It's okay thanks for helping me.

MinhLe2512 commented 1 year ago

Okay so I think I found the problem, apparently the function is trying to get files with .jpg but the dataset contains these instead .npy files, should I reformat it to jpg?

image image

VlSomers commented 1 year ago

You should download the dataset on the internet, and then place the masks downloaded on Google Drive in the "masks" folder. The final dataset folder structure should look like this:

Market-1501-v15.09.15
├── bounding_box_test
├── bounding_box_train
├── masks
│   └── pifpaf_maskrcnn_filtering
│       ├── bounding_box_test
│       ├── bounding_box_train
│       └── query
└── query

With images (.jpg) inside bounding_box_test/bounding_box_train/query on the first level and .npy with the masks inside pifpaf_maskrcnn_filtering, with the same subfolder structure

MinhLe2512 commented 1 year ago

I think it's a problem with file extensions, apparently it detects those files as .npy files not .jpg, i modified the code and it works

image

Update: It didn't work when it comes to feature extraction, I will try to find a way to change it to .jpg files Update: I finally understand this line"You should download the dataset on the internet". Thank you so much