How to predict the optimal image segmentation size through deep reinforcement learning?

The specific problem background is: user specifies the center point (x, y) of the cut image in the original overall image, and the cut image is input into the CNN model for classification prediction.

The question point is, the length of the image side length h when cutting (assuming it is cut into squares), how to find the optimal value h_best within a certain range of [a, b]?

What I think of is the deep reinforcement learning method. How can I get h_best through deep reinforcement learning?

Or is there a method other than deep reinforcement learning?