sadeepj / crfasrnn_keras

CRF-RNN Keras/Tensorflow version
http://crfasrnn.torr.vision
MIT License
603 stars 169 forks source link

Different input size #62

Closed JadBatmobile closed 5 years ago

JadBatmobile commented 5 years ago

How can the code be modified to supported sizes other than 500 x 500?

sadeepj commented 5 years ago

What I normally do to workaround this size restriction is: resize the image to something smaller than 500 x 500 while keeping the aspect ratio, pad the smaller dimension to make the image 500 x 500, run it through the network and reverse the padding/resizing operations on the result. See, for example, https://github.com/sadeepj/crfasrnn_keras/blob/master/src/util.py#L61

We have this size restriction due to historical reasons (porting from a Caffe implementation we wrote back in 2015). If you'd like to truly make the network work on any arbitrary sized network, it's theoretically possible. You'd probably have to make some adjustments to the crop layer parameters in https://github.com/sadeepj/crfasrnn_keras/blob/master/src/crfrnn_model.py