bubbliiiing / Siamese-pytorch

这是一个孪生神经网络(Siamese network)的库,可进行图片的相似性比较。
MIT License
605 stars 129 forks source link

运行自己的数据集时,报错PIL.UnidentifiedImageError: cannot identify image file 'datasets/block\\images_background\\character02\\Thumbs.db' #33

Open CTian-BUG opened 1 year ago

CTian-BUG commented 1 year ago

Traceback (most recent call last): File "F:/work/AI_Project/Siamese-pytorch-master/train.py", line 351, in fit_one_epoch(model_train, model, loss, loss_history, optimizer, epoch, epoch_step, epoch_step_val, gen, File "F:\work\AI_Project\Siamese-pytorch-master\utils\utils_fit.py", line 21, in fit_one_epoch for iteration, batch in enumerate(gen): File "D:\anaconda\envs\ai-project\lib\site-packages\torch\utils\data\dataloader.py", line 521, in next data = self._next_data() File "D:\anaconda\envs\ai-project\lib\site-packages\torch\utils\data\dataloader.py", line 1203, in _next_data return self._process_data(data) File "D:\anaconda\envs\ai-project\lib\site-packages\torch\utils\data\dataloader.py", line 1229, in _process_data data.reraise() File "D:\anaconda\envs\ai-project\lib\site-packages\torch_utils.py", line 434, in reraise raise exception PIL.UnidentifiedImageError: Caught UnidentifiedImageError in DataLoader worker process 0. Original Traceback (most recent call last): File "D:\anaconda\envs\ai-project\lib\site-packages\torch\utils\data_utils\worker.py", line 287, in _worker_loop data = fetcher.fetch(index) File "D:\anaconda\envs\ai-project\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "D:\anaconda\envs\ai-project\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "F:\work\AI_Project\Siamese-pytorch-master\utils\dataloader.py", line 76, in getitem images, labels = self._convert_path_list_to_images_and_labels(batch_images_path) File "F:\work\AI_Project\Siamese-pytorch-master\utils\dataloader.py", line 115, in _convert_path_list_to_images_and_labels image = Image.open(path_list[pair * 2 + 1]) File "D:\anaconda\envs\ai-project\lib\site-packages\PIL\Image.py", line 3186, in open raise UnidentifiedImageError( PIL.UnidentifiedImageError: cannot identify image file 'datasets/block\images_background\character02\Thumbs.db'

Epoch 1/100: 0%| | 0/9 [00:04<?, ?it/s<class 'dict'>]

Process finished with exit code 1

bubbliiiing commented 1 year ago

额,Thumbs.db是什么0 0

CTian-BUG commented 1 year ago

解决了,就是数据集有个临时文件,只是用文件管理器看不见,要在pycharm上删除

CTian-BUG commented 1 year ago

但是最后的运行结果,相同的输入,相似度只有0.527,这是为什么呀

bubbliiiing commented 1 year ago

额 利用全连接判断的

CTian-BUG commented 1 year ago

但是这样的话,效果怎么体现呢