ZhangYuanhan-AI / CelebA-Spoof

[ECCV2020] A Large-Scale Face Anti-Spoofing Dataset
531 stars 92 forks source link

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

Closed Adesoji1 closed 2 years ago

Adesoji1 commented 2 years ago

INFO:root:Initializing detector.
INFO:root:Detector initialized.
INFO:root:Starting runtime evaluation
INFO:root:got local image list, 67170 image
INFO:root:Batchsize=, 1024
[ WARN:0@3.935] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread
('C:\Users\Glodaris\newspoof\CelebA_Spoof\metas\intra_testData/test/6964/spoof/494405.png'): can't open/read file: check file path/integrity
INFO:root:Failed to read image: Data/test/6964/spoof/494405.png
Traceback (most recent call last):
File "main.py", line 83, in
run_test(CelebASpoofDetector, celebA_spoof_image_iter)
File "main.py", line 53, in run_test
for image_id, image in image_iter:
File "C:\Users\Glodaris\newspoof\CelebA-Spoof-master\CelebA-Spoof-master\intra_dataset_code\client.py", line 88, in get_image
image = read_image(image_id)
File "C:\Users\Glodaris\newspoof\CelebA-Spoof-master\CelebA-Spoof-master\intra_dataset_code\client.py", line 34, in read_image
real_h,real_w,c = img.shape
AttributeError: 'NoneType' object has no attribute 'shape'

How do i correct this issue?

ZhangYuanhan-AI commented 2 years ago

Hi,

Make sure your image path is valid.

Adesoji1 commented 2 years ago

Please can you write how it should look like? I used the absolute path to the image file in a windows directory which is r' C:\path\to\image\494405.png' , did I do anything wrong?

ZhangYuanhan-AI commented 2 years ago

Can you write a simple script to ensure OPENCV can read this Image?

Adesoji1 commented 2 years ago

Yes i did and i saw the images printed out, i notice the difference between / and \ so i changed all to \ because of windows now i get this error, please can you spare some time so i could talk to you either on whatsapp or via google meet at your convenience, kindly share your email addy or any contact neccessary for me. the error i have now is

INFO:root:Initializing detector. INFO:root:Detector initialized. INFO:root:Starting runtime evaluation Traceback (most recent call last): File "main.py", line 83, in run_test(CelebASpoofDetector, celebA_spoof_image_iter) File "main.py", line 53, in run_test for image_id, image in image_iter: File "C:\Users\Glodaris\newspoof\CelebA-Spoof-master\CelebA-Spoof-master\intra_dataset_code\client.py", line 78, in get_image image_list = json.load(f) File "c:\users\glodaris\appdata\local\programs\python\python38\lib\json__init.py", line 293, in load return loads(fp.read(), File "c:\users\glodaris\appdata\local\programs\python\python38\lib\json\init__.py", line 357, in loads return _default_decoder.decode(s) File "c:\users\glodaris\appdata\local\programs\python\python38\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "c:\users\glodaris\appdata\local\programs\python\python38\lib\json\decoder.py", line 353, in raw_decode obj, end = self.scan_once(s, idx) json.decoder.JSONDecodeError: Invalid \escape: line 1 column 12 (char 11)

YmanChris commented 2 years ago

INFO:root:Initializing detector. INFO:root:Detector initialized. INFO:root:Starting runtime evaluation INFO:root:got local image list, 67170 image INFO:root:Batchsize=, 1024 [ WARN:0@3.935] global D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp (239) cv::findDecoder imread('C:\Users\Glodaris\newspoof\CelebA_Spoof\metas\intra_testData/test/6964/spoof/494405.png'): can't open/read file: check file path/integrity INFO:root:Failed to read image: Data/test/6964/spoof/494405.png Traceback (most recent call last): File "main.py", line 83, in run_test(CelebASpoofDetector, celebA_spoof_image_iter) File "main.py", line 53, in run_test for image_id, image in image_iter: File "C:\Users\Glodaris\newspoof\CelebA-Spoof-master\CelebA-Spoof-master\intra_dataset_code\client.py", line 88, in get_image image = read_image(image_id) File "C:\Users\Glodaris\newspoof\CelebA-Spoof-master\CelebA-Spoof-master\intra_dataset_code\client.py", line 34, in read_image real_h,real_w,c = img.shape AttributeError: 'NoneType' object has no attribute 'shape'

How do i correct this issue?

Hello, Adesoji1. Nice to see you again. Did you run it successfully?