YYuanAnyVision / mxnet_mtcnn_face_detection

MTCNN face detection
738 stars 314 forks source link

TypeError in extract_image_chips #57

Open Morceguito opened 3 years ago

Morceguito commented 3 years ago

File "main.py", line 22, in chips = detector.extract_image_chips(img, points, 144, 0.37) File "/content/drive/My Drive/mxnet_mtcnn_face_detection-master/mtcnn_detector.py", line 484, in extract_image_chips for k in range(len(p)/2): TypeError: 'float' object cannot be interpreted as an integer

I didn't change anything besides switching izip to zip

naserpiltan commented 3 years ago

Hey I solved this problem. Change these lines in mtcnn_detector.py as followings : line 431 : change reshape(from_shape.shape[0]/2, 2) to reshape(int(from_shape.shape[0]/2), 2) line 432 : change to_shape.reshape(to_shape.shape[0]/2, 2) to to_shape.reshape(int(to_shape.shape[0]/2), 2) line 485 : change range(len(p)/2) to range(int(len(p)/2)) line 500 : range(len(shape)/2) to range(int(len(shape)/2))

In summary put an int before the devisions.

dreamlychina commented 2 years ago

thanks a lot