yinguobing / facial-landmark-detection-hrnet

A TensorFlow implementation of HRNet for facial landmark detection.
GNU General Public License v3.0
157 stars 40 forks source link

Training error #5

Closed glmanhtu closed 3 years ago

glmanhtu commented 3 years ago

Hello @yinguobing

It's me again, I have found there is a problem in the implementation, when I was trying to train the network with the 300VW dataset, the following problem occurred: ValueError: could not broadcast input array from shape (19,19) into shape (20,19)

It turned out that the problem appear in here: https://github.com/yinguobing/facial-landmark-detection-hrnet/blob/master/mark_operator.py#L112-L113

The int() is not always do the same thing, as you can see in the debugging output below:

Screenshot 2020-12-10 at 18 55 16

It's easy to solve this problem, I have replaced the int function by the following:

def r_int(f_number):
    if f_number >= int(f_number) + 0.5:
        return int(f_number) + 1
    else:
        return int(f_number)
yinguobing commented 3 years ago

Hi @glmanhtu

Sorry I can not reproduce this issue. According to the error message there was a mismatch of tensor shapes. Could you provide the arguments for the heatmap generation function, or the image and mark samples so I can check in detail?

Thanks!

glmanhtu commented 3 years ago

Hello @yinguobing To reproduce the error, you can extract the files in the attachment and put it into the root folder of this project, then run the testing.py. the image and marks in the test folder is coming from the 300vw database testing.zip

yinguobing commented 3 years ago

Confirmed, and your fix is valid.

I think we should re-write this function.

yinguobing commented 3 years ago

The latest commit should resolve this issue. Please re-open it if not.