guxinqian / TKP

Pytorch implementation of Temporal Knowledge Propagation for Image-to-Video Person Re-identification
Apache License 2.0
59 stars 10 forks source link

关于video_loader.py第99行的问题 #7

Closed 1691077362 closed 1 year ago

1691077362 commented 2 years ago

我运行你的代码出现了如下的问题,请问是怎么回事。 Traceback (most recent call last): File "train.py", line 463, in main() File "train.py", line 200, in main train(epoch, vid_model, img_model, classifier, criterion, criterion_tkp_f, criterion_tkp_d, criterion_i2v, optimizer, trainloader, use_gpu) File "train.py", line 253, in train for batchidx, (vids, pids, ) in enumerate(trainloader): File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next data = self._next_data() File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data\dataloader.py", line 1203, in _next_data return self._process_data(data) File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data\dataloader.py", line 1229, in _process_data data.reraise() File "C:\Users\administer.conda\envs\p\lib\site-packages\torch_utils.py", line 434, in reraise raise exception RuntimeError: Caught RuntimeError in DataLoader worker process 0. Original Traceback (most recent call last): File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data_utils\worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "F:\YDH\spxrcsb\TKP-master\utils\video_loader.py", line 99, in getitem clip = torch.stack(clip, 0).permute(1, 0, 2, 3) RuntimeError: stack expects a non-empty TensorList

guxinqian commented 2 years ago

字面意思是你的clip是空的,你可以检查下你的数据或者clip前的代码有没有问题

1691077362 commented 2 years ago

好的

1691077362 commented 2 years ago

你能详细分享一下你数据集的存放目录吗?谢谢

guxinqian commented 2 years ago

data/ ----DukeMTMC-VideoReID ----MARS ----iLIDS-VID

1691077362 commented 2 years ago

/data/datasets/MARS/bbox_train /data/datasets/MARS/bbox_test 这么放对吧

guxinqian commented 2 years ago

对的,路径没问题,你可以检查下是不是有些样本丢了

guxinqian commented 2 years ago

或者Windows下的路径是不是改改成双斜杠

1691077362 commented 2 years ago

好的,谢谢。麻烦你了。

1691077362 commented 2 years ago

捕获 捕获1 捕获2 捕获3 捕获4 捕获5 捕获6 我在 start train出现这个错误,我改完路径后start train不出现这个错误了。但是在test部分出现这个错误了,所以我想知道我的路径是否还有问题。 ==> Start training C:\Users\administer.conda\envs\p\lib\site-packages\torch\optim\lr_scheduler.py:134: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate "https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate", UserWarning) F:\YDH\spxrcsb\TKP-master\utils\losses.py:108: UserWarning: This overload of addmm is deprecated: addmm(Number beta, Number alpha, Tensor mat1, Tensor mat2) Consider using one of the following signatures instead: addmm_(Tensor mat1, Tensor mat2, *, Number beta, Number alpha) (Triggered internally at ..\torch\csrc\utils\python_arg_parser.cpp:1050.) imgdistmat.addmm(1, -2, images, images.t()) Epoch1 Time:593.4s Data:17.5s vXent:6.6427 iXent:6.6635 TKP_F:4.4849 TKP_D:0.4471 i2v:0.2863 v2i:0.4856 i2i:0.5366 v2v:0.2403 vAcc:3.37% iAcc:3.37% ==> Test Extract video features Traceback (most recent call last): File "train.py", line 471, in main() File "train.py", line 208, in main rank1 = test(vid_model, img_model, queryloader, galleryloader, queryimgloader, galleryimgloader, use_gpu) File "train.py", line 341, in test for batch_idx, (vids, pids, camids) in enumerate(queryloader): File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next data = self._next_data() File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data\dataloader.py", line 561, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\administer.conda\envs\p\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "F:\YDH\spxrcsb\TKP-master\utils\video_loader.py", line 116, in getitem clip = torch.stack(clip, 0).permute(1, 0, 2, 3) RuntimeError: stack expects a non-empty TensorList

guxinqian commented 2 years ago

我也不知道,没在windows下跑过,不行你改Linux试试