wl-zhao / DiffSwap

[CVPR 2023] DiffSwap is a diffusion-based face-swapping framework.
99 stars 10 forks source link

The code encountered some issues while running.AttributeError: module 'PIL.Image' has no attribute 'LINEAR' #11

Open zkwlldz opened 10 months ago

zkwlldz commented 10 months ago

Dear author,

I am writing to you with a request for assistance. I recently downloaded the code from your GitHub repository and attempted to run it on my local machine. However, I have been encountering an issue that has prevented me from successfully executing the code.

Despite these efforts, I am still encountering the same error message.

I would be grateful if you could take a look at the code and assist me in resolving this issue. It would be greatly appreciated if you could identify the cause of the error and provide any necessary modifications or suggestions to resolve it.

Thank you in advance for your time and support. I am looking forward to hearing from you soon.

The error message that I am receiving is as follows: (/media/lii/d/condaubuntu/pkgs/diffswap) lii@lii:/media/lii/d/win/conda/ai/DiffSwap$ python pipeline.py 100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 4.28it/s] 100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 2.87it/s] image: 100%|██████████████████████████████████████| 1/1 [00:00<00:00, 10.09it/s] type source img_count 1 image: 100%|██████████████████████████████████████| 1/1 [00:00<00:00, 4.72it/s] type target img_count 1 Recreating aligned images... image: 100%|██████████████████████████████████████| 1/1 [00:00<00:00, 7.80it/s] type source finished, processed 1 images image: 100%|██████████████████████████████████████| 1/1 [00:00<00:00, 7.50it/s] type target finished, processed 1 images image: 100%|██████████████████████████████████████| 1/1 [00:00<00:00, 71.89it/s] type source img_count 1 image: 100%|██████████████████████████████████████| 1/1 [00:00<00:00, 78.05it/s] type target img_count 1 running face detection 2023-10-21 18:29:23.500496: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-10-21 18:29:24.490404: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT 2023-10-21 18:29:27.136633: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1960] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. Skipping registering GPU devices... 1/1 [==============================] - 0s 219ms/step | 0/1 [00:00<?, ?it/s] 1/1 [==============================] - 0s 86ms/step 1/1 [==============================] - 0s 18ms/step 1/1 [==============================] - 0s 17ms/step 1/1 [==============================] - 0s 17ms/step 1/1 [==============================] - 0s 17ms/step 1/1 [==============================] - 0s 16ms/step 1/1 [==============================] - 0s 16ms/step 2/2 [==============================] - 0s 4ms/step 1/1 [==============================] - 0s 109ms/step 100%|█████████████████████████████████████████████| 1/1 [00:01<00:00, 1.10s/it] 1/1 [==============================] - 0s 19ms/step | 0/1 [00:00<?, ?it/s] 1/1 [==============================] - 0s 18ms/step 1/1 [==============================] - 0s 16ms/step 1/1 [==============================] - 0s 15ms/step 1/1 [==============================] - 0s 16ms/step 1/1 [==============================] - 0s 16ms/step 1/1 [==============================] - 0s 16ms/step 1/1 [==============================] - 0s 16ms/step 1/1 [==============================] - 0s 18ms/step 1/1 [==============================] - 0s 19ms/step 100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 2.12it/s] gpu 0 process 1 images running mtcnn source 0.png target 0.png obtain the parameters of affine transformation 100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 38.27it/s] type: source, cnt: 1 100%|█████████████████████████████████████████████| 1/1 [00:00<00:00, 77.59it/s] type: target, cnt: 1 len(self.src_list): 1 Traceback (most recent call last): File "pipeline.py", line 418, in save_mask() File "pipeline.py", line 328, in save_mask dataset = Portrait('data/portrait') File "/media/lii/d/win/conda/ai/DiffSwap/utils/portrait.py", line 42, in init self.interpolation = {"linear": PIL.Image.LINEAR, AttributeError: module 'PIL.Image' has no attribute 'LINEAR'

mobassir94 commented 10 months ago

run pip install pillow==9.5.0 will solve this problem.