liudakai2 / UnsupDIS-pytorch

A pytorch implementation of UnsupervisedDeepImageStitching
GNU General Public License v3.0
112 stars 20 forks source link

AttributeError: 'NoneType' object has no attribute 'shape' #20

Closed monkeycc closed 1 year ago

monkeycc commented 2 years ago

anaconda python 3.7 win11

UnsupDIS-pytorch\data\WarpedCOCO 已经解压training testing 数据集

 python train.py --data data/warpedcoco.yaml --hyp data/hyp.align.scratch.yaml --cfg models/align_yolo.yaml --weights 
D:\0SDXX\UnsupDIS-pytorch\weights\udis_align_yolo.pt --batch-size 64 --img-size 128 --epochs 50 --adam --device 0 --mode align

CUDA:0 (NVIDIA GeForce RTX 3080 Ti Laptop GPU, 16383.5MB)

hyperparameters: lr0=0.0001, lrf=0.1, momentum=0.9, weight_decay=0.0, warmup_epochs=0.0, warmup_momentum=0.8, warmup_bias_lr=0.1, loss_scale1=16.0, loss_scale2=4.0, loss_scale3=1.0, hsv_h=0.015, hsv_s=0.2, hsv_v=0.15, degrees=0.05, translate=0.1, scale=0.1, shear=0.01, perspective=0.0005, flipud=0.1, fliplr=0.5

                 from  n    params  module                                  arguments
  0                -1  1      8800  models.common.Focus                     [3, 80, 3, 1, None, 1, True, 'BN']
  1                -1  1    115520  models.common.Conv                      [80, 160, 3, 2, None, 1, True, 1, 'BN']
  2                -1  1    309120  models.common.C3                        [160, 160, 4, True, 1, 0.5, 'BN']
  3                -1  1    461440  models.common.Conv                      [160, 320, 3, 2, None, 1, True, 1, 'BN']
  4                -1  1   3285760  models.common.C3                        [320, 320, 12, True, 1, 0.5, 'BN']
  5         [0, 2, 4]  1         0  torch.nn.modules.linear.Identity        []
  6                -1  1  11512704  models.yolo.HEstimator                  [128, [2, 4, 8], 0.5, 'BN', [80, 160, 320]]
Model Summary: 253 layers, 15693344 parameters, 15693344 gradients, 14.6 GFLOPs

Transferred 327/327 items from D:\0SDXX\UnsupDIS-pytorch\weights\udis_align_yolo.pt
Scaled weight_decay = 0.0
Optimizer groups: 56 .bias, 59 conv.weight, 53 other
[ WA[RN: WARN:0@10.438] global D:\a\open0@11.888] global Dcv:\a\-python\opencv-python\opencvopencv-python\openc\modules\imgcodecs\v-pysrc\loadsavethon\op[.cpp (239) cv::f[e indDe[ ncv\modules\imgcodc WARecs\src\loadsave[ WARN:W[WN:0@A ARN:0@8..cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input1/049113.jpg'): can't open/read file: check file path/integrity
WARN0@2.930] global D:\a\opencv-pyt[ oder imread_('WarpedCOCO/traW[:0@49ining/input1/03306Rhon\opencv-python\opeN:0@6.025] globalARN:0@28] gl.49 76.jpg'): can't open/read f4] gl11.892] global D:\a\opencile: check file path/incv WAv-py\modules\imgcodecs\src\loadsaD:\a\opencv-python\opencv-obal D:\a\opencv-.RN:0@1.388] global ve.copython\opencv\modules\imgcodecs\src\loadsabal D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\pp (python\opencthon\opencv-pythonnsrc\loadsave.cpp D:\a\opencvtegrity
ve.cpp [ WARN:(239) cv::find0@10.448] 239) cv::findDecoder imread_('W-pytglobal D:\a\v-pytarpeho\hDopd4n\opencv-pytho6opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/049COCO/trai3] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input1/021667.jpg'): can'ning/input1/04847e(113oe8.jpg'): can't open/rcodnt open/read file: check ead file: chenfile path2er imread_('WarpedCOCO/training/input1/046529.jpg'): can't open/read file: check file path/integrity
ck file path/integrity
ncv-python\o[\[ WARN:0@2.948] global D:\a\opencv-pyth.pencv-pytopencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findD3/integrity
 WARN:0@6.042] global D:\a\opeecoder ncv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoderjpg'): can't open/read file: check file path/integrity
on\open imread_('WarpedCOCO/training/input2/0469\cv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/048478.jpg'): can't open/read fi529.jpg'): can't open/read file: chec)o[himk p ole: cencv\mcv::findDecoder imread_('WarpedCOCO/training/inread_('WarpedCOCO/training/input1/005148.jpg'): can't open/read file: check file path/integrity
n[put1/013316.jpg'): can't open/read file: check file path/integrity
WARN:0@7.483] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findodules\imgcodecs\src\lheck file path/integrity
 WARN:0@11.914] global D:\a\opencv-p\ooadsave.cpp (239) cv::findDeython\cDp [ WARN:0@8.958] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/013316.jpg'): can't open/read file: check file path/integrity
[[ WARN:0@2.962] global D:\a\opencv-python\opencv-pyecoder imread_('WarpedCOCO/training/input2/0f WARN:0@4.522] global D:\a\opencv-python\open[ WARN:0@8.964] global D:\a\opencv-python\ope21667.jpiopencv-python\opencv\modules\imgcncv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/033066.jpg'): can't open/read file: check file path/integrity
tencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDeccv-python\opencglooder imread_('WarpedCOCO/training/input1/015895.jpg'): can't open/read file: check fiho[ '): can't open/read file: check file path/integrity
le path/integrity
dodvWe[er imread_('WarpedCOCO/trae\A  n[ WARN:0@7.RN:0@cs\src\10.481] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cWARN:0@8.973] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findmopp\ining/input1/031931.jpg'): can't open/read file: check file path/integrity
p (239) cv::findDecoder imread_('WarpedCOCO/training/input1/032323.jpg'): can't open/read file: check file path/integrity
loadsave.cdules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/005148.jpg'): can't open/read file: check file path/integrity
520] global D:\aopen[ WARN:0@1.449] globa[ WARN:0@10.503]a\opencv-python\opencv-python\opencv\modules\img th/integrity
codecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input1/012598.jpg'): can't open[[ WARN:0@4.560] global D:\a\opencv-python\opglobal D:\a\ocencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecode WARN:0@6.092] globalr imread_('WarpedCOCO/training/input1/028892.jpg'): can't open/read file: check file path/integrity
vD/read file: check file path/integrity
 D:\a\o[ WARN:0@7.535] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodec[\elppes\src\loadsave.cpp (239) cv:: WARN:0@modules\imgcodecs\src\loadsave.cpp (239) c4.565] global D:\a\opencv-python\opencv-python\opencv\modules\iv::findDecoder imrpncv-python\opencv-pythomgcodecs\ pead_('WarpedCOCO/training/input1/039182.jpg'): can't open/read file: check file path/integrity
csrc\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/028892.jpg'): can't open/read file: check file path/integrity
fn\openc[ WARN:0D:iv\modules\imgcode\a\opencv-python\opencv-python\op@3.009encv\m] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/039182.jpg'): can't open/read file: check file path/integrity
odules\nnoecs\src\loadsave.cpp (239) ccdDecoder imread_('WarpedCOCO/training/input2/012598.jpg'): can't op iv::findDecoder imread_('Warven/read file: check file -python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/032323.jpg'): can't open/read file: checkdep( prma2file path/inteth/igcodecgrity
39) cv::findDecoder imread ntegrit_('WarpedCOCO/training/input1/023377.jpg'): can'y
set \src\imread_('WarpedCOCOodCOCO/training/input1/020006.jpg'): can't open/read file: check file path/integrity
pe/traini[ WARN:0@6.119] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/020006.jpg'): can't open/read file: check file path/n/read file: check file path/integrity
integrity
ng/input2/015895.jpg'): canloa[ WARN:0@11.986] global D:\a\opencv-python\opencv-python\opencd'v\modules\imgcodecs\srt open/read file: check file path/integrity
c\loadsave.cpp (239) csave.cpp (239) cv::findDecoder imread_('v::findDecoder imread_('WWarpedCOCO/training/input2/023377.jpg'): can'tarpedCOCO/training/input2/031931.jpg'): can't open/read file: check file path/integrity
 open/read file: check file path/integrity
[ WARN:0@1.490] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input1/000599.jpg'): can't open/read file: check file path/integrity
[ WARN:0@1.495] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input2/000599.jpg'): can't open/read file: check file path/integrity
[ WARN:0@18.454] gl[ WARNo:0@16.9bal D:\a\open[ c4Wv-python\o[1ARN] glo Wpebal n:A[ WARR[[ cv-p WARN:ython0@WARN:01D:\\openN:0@10cv\mod.a\@4NImage sizes 128 train, 128 test
Using 8 dataloader workers
Logging results to runs\train\exp3
Starting training for 50 epochs...
ules\im593] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::find:gcodeDeco5.4cs0@12.494] g.384] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\srcoder imread_(\src\loadsaloba\loadsave.cpp (239) cv::ve.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/000001.jpg'): can't open/read file: checkfindDecoder imread_('WarpedCOCO/testing/input1/000385.jpg'): can'0'Wa
     Epoch   gpu_mem     loss1     loss2     loss3     total  img_size
 3t open/read file: c@8.1file path/integrity
  0%|                                                                                                                                                                                                          | 0/782 [00:00<?, ?it/s]r  0%|                                                                                                                                                                                                          | 0/782 [00:00<?, ?it/s][
6 grobal D:\a\opencv-python\opencv-python\opencv\modules\imgces\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/000129.jpg'): can't open/read file: check filpedCOCO/testing/input1/000513.jpg'): can't open/read file: check file path/integrity
 WARN:0@30.567] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/training/input1/006577.jpg'): can't open/read file: check file path/integrity
4] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('Warpl[odecs\src [Traceback (most recent call last):
[a
eeo\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/000641.jpg'): can't open/read file: check file path/integrit\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/000257.jpg'): can't open WARN:WARN:0@2.610] global D:\a\opencv-pyt0@  File "train.py", line 393, in <module>
/r[dCOCO/testing/input2/000001.jpg'): can't oba     3train(opt)ead file: check file path/integrity

 WARN:0@12.405] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/000385.jpg'): can'pen/read file: check file path/integrity
y[ WARN:0@14.520] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2thlW0
  File "train.py", line 229, in train
 [ WARN:0@18.483    pafor i, imgs in pbar:  # batch -------------------------------------------------------------------------on
.] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/001025.jpg'): can't open/read file: check file path/integrity
 D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/000769.jpg'): can't open/read[ WAR[ WARN:0@8.221] global D:\a\opencv-python\op572] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\l open/read file: check file path/integrity
N:0@18.486] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv\  File "D:\Anaconda3\envs\UnsupDIS\lib\site-packages\tqdm\std.py", line 1195, in __iter__
encv-python\A::findoRo/oadsDecoder imread_('WarpedCOCO/testing/input2/001025.jpg'): can't open/read file: check file p    pencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/000641.jpg'): can't open/read file: check file path/integrity
ave.cpp (239) cv::find t[ WARN:0@12.423] global D:for obj in iterable:p000257.jpg'): can't oath/integrity
fhpen
NDe/in[ WARN:0@8.235] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/001665.jpg'): can't open/read file: check file path/integrity
/read file: check file path/integrity
encv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findile: check file path/integrity
tegrity[   File "D:\0SDXX\UnsupDIS-pytorch\utils\datasets.py", line 51, in __iter__
:Decoder imread_('WarpedCOCO/testing/input1/000897.jpg'): can't open/re0[ WARN:0@14.541] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_@10.607] global D:\a\
ad file: check file path/integrity
c\W[opencv-python\opencv-python\opencv\modules\imgcodecs\src [ W[ WARN:0@2.653] globaWARN:0@8.238] global D:\a\opencv-python\opencv-python\opencv\modules\iARN:0@5.mgc(    Aoa4\l D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/000897.jpg'): can't open/read file: check file path/integrity
der imread_('RN\ope'WarpedCOCO/training/input2/006577.jpg'): can't opWarpedCOCO/testing/input1/00128yield next(self.iterator)lncv-pythono:0@16.993] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (2391) cv::findDecoder imread_('WarpedCOCO/testing/input2/000129.jpg'): can't open/read file: check file path/integrity
en/read file: check file path/integrity
.jpg'\
o7[ ): can't o6dWARN:0@2.670] global D:\a\opencv-python\opencv-python\opencv\modules\imgcode] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/000769.jpg'): can't open/read file: check file path/integri  File "D:\Anaconda3\envs\UnsupDIS\lib\site-packages\torch\utils\data\dataloader.py", line 681, in __next__
adcs\src\loadsave.cpen/read filpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/001921.jpg'): can't open/read file: check fiecs\src\loadsave.cpp (239) cv::findDecoder imrsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/000513.jpg'): can't open/read file: check file path/integrity
le path/integrity
tye: check file path/integrio[[e
    tpe ad_('WarpedCOCnWAR [ WARN:0@y
N:0@2.679] gloOcv-python\opencv\modules\imgco/10.677] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\WARdecs\src\loadsave.csrc\loadsave.cpp (239) cv::fpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/001409.jpg'): can't open/read file: check file ptesting/input2/001665.jpg'): can't open/read file: check file path/integrity
ath/integrity
[ WAN:0@17.015indDecoder imread_('WarpedCOCO/testing/input1/001537.jpg'): can't[ WARN:0@5.514bal D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (23 open/read file: check9) cv::findDecoder imread_('WarpedCOCO/testing/input2/001921.jpg'): can't open/read file: check file path/integrity
]] global D:\a\opencv-py [ WARN:0@12.472] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\lRN:0@14.578] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/001281.jpg'): can'tdata = self._next_data()thon\open open/read file: check file path/integrity
 global D:\a\opencv-pythoncfioadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/t
l\v-pythoe path/  File "D:\Anaconda3\envs\UnsupDIS\lib\site-packages\torch\utils\data\dataloader.py", line 1376, in _next_data
n\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input1/00e    inreturn self._process_data(data)sopencv-python\opetegrity
n1793.jpg'): can't open/read file: check file path/integrity
cv\modules\imgcodecs\sr[ WARN:0@10.693] global D:\a\opencv-python\opencv-pyc\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/001409
tthon\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/001537.jpg'): can't open/read file: check file path/integrity
[.jpg'): can't open/read file:ing/inp WARN:0@5.530] global D:\a\opencv-python\opencv-python\opencv  File "D:\Anaconda3\envs\UnsupDIS\lib\site-packages\torch\utils\data\dataloader.py", line 1402, in _process_data
 check file path/integrity\modules\imgcodecs\src\lo    udata.reraise()adsave.cpp (239) cv::findDecoder imread_(

t1/'War001pedC153.jpg'): canOCO/testing/input2/001793.jpg'): can't open/read file: check file pat  File "D:\Anaconda3\envs\UnsupDIS\lib\site-packages\torch\_utils.py", line 461, in reraise
't open/read file: check file path/integrity
h[ WARN:0@/integrity
17.050] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread_('WarpedCOCO/testing/input2/001153.jpg'    ): canraise exception't open/rea
d file: check fileAttributeError path/integrity
: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "D:\Anaconda3\envs\UnsupDIS\lib\site-packages\torch\utils\data\_utils\worker.py", line 302, in _worker_loop
    data = fetcher.fetch(index)
  File "D:\Anaconda3\envs\UnsupDIS\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:\Anaconda3\envs\UnsupDIS\lib\site-packages\torch\utils\data\_utils\fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "D:\0SDXX\UnsupDIS-pytorch\utils\datasets.py", line 114, in __getitem__
    img1, img2, msk1, msk2 = self.load_data_(self.img_files[index])
  File "D:\0SDXX\UnsupDIS-pytorch\utils\datasets.py", line 168, in load_data_
    if tuple(img1.shape[:2]) != new_size or tuple(img2.shape[:2]) != new_size:
AttributeError: 'NoneType' object has no attribute 'shape'
tgjjj commented 2 years ago

看起来是OpenCV读取图像失败的问题,请确认数据集路径是否正确。 在main.sh所在的目录下应该存在WarpedCOCO这个数据集文件夹,如果没有的话请参考下面的命令建立软链接。 在main.sh所在目录下运行: ln -sf <解压出的WarpedCOCO数据集文件夹> WarpedCOCO

Onlydrink commented 1 year ago

你好请问你解决这个问题没有