You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "C:\Users\KB\Desktop\COVID-Net-master\data.py", line 15, in crop_top
offset = int(img.shape[0] * percent)
AttributeError: 'NoneType' object has no attribute 'shape'
The text was updated successfully, but these errors were encountered:
Hi @khanbhai0078,
This error occurs when the image is not found at the passed-in file path. Please verify that the passed-in data directory is correct and that the image file path is correct (this can be done by printing out the file path passed into the function process_image_file()).
@LindenY Kindly help
def crop_top(img, percent=0.15):
offset = int(img.shape[0] * percent)
return img[offset:]
def central_crop(img):
size = min(img.shape[0], img.shape[1])
offset_h = int((img.shape[0] - size) / 2)
offset_w = int((img.shape[1] - size) / 2)
return img[offset_h:offset_h + size, offset_w:offset_w + size]
def process_image_file(filepath, top_percent, size):
img = cv2.imread(filepath)
img = crop_top(img, percent=top_percent)
img = central_crop(img)
img = cv2.resize(img, (size, size))
return img
ERROR
File "C:\Users\KB\Desktop\COVID-Net-master\data.py", line 15, in crop_top
offset = int(img.shape[0] * percent)
AttributeError: 'NoneType' object has no attribute 'shape'
The text was updated successfully, but these errors were encountered: