AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
https://github.com/mingcv/Bread/blob/e0c50680f38ac9f417ef6a233448f94e68f332f2/datasets/low_light_test.py#L35
Traceback (most recent call last):
File "D:\dev_projects\image_ai\Bread\test_Bread.py", line 195, in <module>
test(opt)
File "D:\dev_projects\image_ai\Bread\test_Bread.py", line 162, in test
for iter, (data, subset, name) in enumerate(test_generator):
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\tqdm\std.py", line 1181, in __iter__
for obj in iterable:
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\torch\utils\data\dataloader.py", line 708, in __next__
data = self._next_data()
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\torch\utils\data\dataloader.py", line 1480, in _next_data
return self._process_data(data)
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\torch\utils\data\dataloader.py", line 1505, in _process_data
data.reraise()
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\torch\_utils.py", line 733, in reraise
raise exception
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\torch\utils\data\_utils\worker.py", line 349, in _worker_loop
data = fetcher.fetch(index) # type: ignore[possibly-undefined]
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\torch\utils\data\_utils\fetch.py", line 52, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\dev_projects\image_ai\Bread\.venv\lib\site-packages\torch\utils\data\_utils\fetch.py", line 52, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "D:\dev_projects\image_ai\Bread\datasets\low_light_test.py", line 35, in __getitem__
img = img.resize((img.width // 8 * 8, img.height // 8 * 8), Image.ANTIALIAS)
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
stackoverflow solution - replace ANTIALIAS with Resampling.LANCZOS or specify the old version pip install Pillow==9.5.0
ANTIALIAS was removed in Pillow 10.0.0 (after being deprecated through many previous versions). Now you need to use PIL.Image.LANCZOS or PIL.Image.Resampling.LANCZOS. (This is the exact same algorithm that ANTIALIAS referred to, you just can no longer access it through the name ANTIALIAS.)
Changing line 35 in datasets/low_light_test.py to this resolved the issue for me.
img = img.resize((img.width // 8 * 8, img.height // 8 * 8), Image.Resampling.LANCZOS)