Multiple digits MNIST and transfer learning I have a sample of 50,000 images, some of which are shown below:

 $\qquad$
  $\qquad$  $\qquad$  $\qquad$ 

Associated to these images are labels for the digit with the largest pixel size. My goal is to build a machine learning model to predict the largest digit in an image by pixel size.

To that end, I used transfer learning on the resnext model, but only found an accuracy of 60%.

Given that this implementation uses transfer learning to train a model to predict MNIST digits, I would now like to crop each training image to retain only the largest digit and then train the model using the linked implementation.

So, my question is, how I do crop the training images to retain only the digit in each image with the largest size.
You need to manually or automatically draw bounding boxes around each digit. Then compute the area for each box and take the largest.

Given they are non-overlapping black digits on a white background, template matching would work.