wbenbihi / hourglasstensorflow

Tensorflow implementation of Stacked Hourglass Networks for Human Pose Estimation
MIT License
479 stars 177 forks source link

Some error #18

Closed Crazod closed 2 years ago

Crazod commented 6 years ago

Hey , it is a really helpful job for me. I have find some bugs It seems that your python is different with mine. In inference.py when i use function predictHM. I add this code return self.predict.pred((img.astype(np.float32) / 255), debug = False, sess = None) instead of original one. So i think this is the reason why some body get high accuracy but wrong visialble results. And other funtion is like this, before i use it. I must change the data type into float. Includes this. In datagen.py line 282 it should not be if bounds[1] > width - 1: it should be if bounds[1] > height - 1: This line some times may cause error.

Besides this, the rotate function mine is different(OpenCV 310). transform.rotate(img, r_angle, preserve_range = True) line336 in datagen.py will cause error

so i change it into . img = transform.rotate(img, r_angle) Hope these jobs help others.

wbenbihi commented 6 years ago

Thanks for the feedback. Indeed the OpenCV dependency might causes errors. I will add a way to choose the image processing module in the next version.

Could you enlighten me about the predictHM modification. What do you mean by 'So i think this is the reason why some body get high accuracy but wrong visialble results.'

Crazod commented 6 years ago

Hi, i have figure out that why the transform.rotate(img, r_angle, preserve_range = True) get errors. The reason is the version of skimage(sickit image). It seems only high version sickit image (v1.3) support this.

In the predictHM.(line 125 in inference.py) Your original code is return self.predict.pred(self, img / 255, debug = False, sess = None) In my python. img/255 will cause data lost. So i cannot get the right prediction. For example 1/255 = 0 so all the similar function i have changed to return self.predict.pred((img.astype(np.float32) / 255), debug = False, sess = None) and then get right result.

I have noticed that many people in isses6 meet this problem. Because the data lost.

ZhuohaoMai commented 6 years ago

because in python2 : img / 255 return int in python3 : img / 255 return float