serengil / deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
https://www.youtube.com/watch?v=WnUVYQP4h44&list=PLsS_1RYmYQQFdWqxQggXHynP1rqaYXv_E&index=1
MIT License
11.82k stars 2.02k forks source link

DeepFace.analyze Negative dimension error #381

Closed sxs4337 closed 2 years ago

sxs4337 commented 2 years ago

I am trying to run analyze on a sample image (256x256, png).

I encounter this error- ValueError: Negative dimension size caused by subtracting 2 from 1 for '{{node max_pooling2d_1/MaxPool}} = MaxPool[T=DT_FLOAT, data_format="NCHW", explicit_paddings=[], ksize=[1, 1, 2, 2], padding="VALID", strides=[1, 1, 2, 2]](Placeholder)' with input shapes: [?,128,112,1].

This seem to happen in the model_build call. Any tips on this error?

I am using- deepface 0.0.68 tensorflow 2.6.2 opencv-python 4.5.4.60

sxs4337 commented 2 years ago

It turns out this was a channels order issue. I had to change keras config to channels_last and it works now. Thanks.