Closed zwq11 closed 9 months ago
This error occur when Cv2 can't read image, please check the data path you can use below code to debug
image = cv2.imread(path)
assert image is not None, path
use this to Fix
folder = os.path.join(data_dir, self.photo)
files = os.listdir(folder)
self.image_files[self.photo] = [os.path.join(folder, fi) for fi in files]
for opt in [self.style, self.smooth]:
files = os.listdir(opt)
self.image_files[opt] = [os.path.join(opt, fi) for fi in files]
Init models... Compute mean (R, G, B) from 1793 images 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▊| 1791/1793 [00:06<00:00, 281.65it/s] Traceback (most recent call last): File "train.py", line 247, in
main(args)
File "train.py", line 124, in main
AnimeDataSet(args),
File "/root/autodl-tmp/pytorch-animeGAN-master/dataset.py", line 32, in init
self.mean = compute_data_mean(os.path.join(anime_dir, 'style'))
File "/root/autodl-tmp/pytorch-animeGAN-master/utils/image_processing.py", line 114, in compute_data_mean
total += image.mean(axis=(0, 1))
AttributeError: 'NoneType' object has no attribute 'mean'