XinArkh/VNect

Support for TensorFlow v2?

Closed this issue · 2 comments

This is quite an old TensorFlow version. It would be great if this would be updated to support tf2.0 and above.

From what I could see in the repo this seems not too hard.

I managed to load and run the old weights with TF 2.0 see test-notebook.ipynb in my last commit.

However, I had to change how you stack the heatmaps. This does not work for me:
hm_avg += scaled_hm[mid[0] - hm_size // 2: mid[0] + hm_size // 2, mid[1] - hm_size // 2: mid[1] + hm_size // 2, :]
When I run it I get:
ValueError: operands could not be broadcast together with shapes (46,46,21) (7,7,21) (46,46,21)
Replacing it with
rescale = hm_avg.shape[0] / scaled_hm.shape[0] hm_avg += cv2.resize(scaled_hm, (0, 0), fx=rescale, fy=rescale, interpolation=cv2.INTER_LINEAR)
works for me. However, it seems not the right way. Any chance you can explain the rational behind your code? As ist still seems a bit wonky right now.

Thanks.

Glad you could do this work!
About your question:
The paper author mentioned they used different scales:
Snipaste_2020-05-25_10-27-26
In
hm_avg += scaled_hm[mid[0] - hm_size // 2: mid[0] + hm_size // 2, mid[1] - hm_size // 2: mid[1] + hm_size // 2, :]
the logic here is to rescale the heatmap trained with scaled image and crop the center part:
image
You can have a check which part in your code is missing.