i am trying to crop out the faces from instagram avatars by first detecting the faces and then resizing the image. i am reading all the images which have been stored in a dataframe and then creating a numpy array. Then i am running a frontal face detector which returns me an object but when i call the object it returns me the error stated. i tried giving only colored images as input but that did not work neither did try and except. Here is the code:
df = pd.read_csv('/home/instaurls2.csv')
img_width, img_height = 139, 139
confidence = 0.8
#graph = K.get_session().graph
data1 = np.array([io.imread(row[1]) for row in df.itertuples()])
#print(data1)
detector = dlib.get_frontal_face_detector()
print (detector)
dets=detector(data1,1) # **error arrives here**
print (dets)
output=None
for i, d in enumerate(dets):
data1 = data1[d.top():d.bottom(), d.left():d.right()]
data1 = resize(data1, (img_width, img_height))
output = np.expand_dims(data1, axis=0)
print (output)