How to do it...

Let's preprocess the raccoon dataset and build an object localization model:

  1. Our dataset contains images of different sizes. Let's fix the image's width and height and initialize a few other parameters:
image_channels = 3batch_size = 15image_width_resized = 96image_height_resized = 96model_name = "raccoon_1_"
  1. Now, we rescale the coordinates of the bounding box according to the new image dimensions:
labels$x_min_resized = (labels[,'xmin']/(labels[,'width']) * image_width_resized)%>% round()labels$y_min_resized = (labels[,'ymin']/(labels[,'height']) * image_height_resized)%>% round()labels$x_max_resized = (labels[,'xmax']/(labels[,'width']) * image_width_resized)%>% round()labels$y_max_resized = (labels[,'ymax']/(labels[,'height']) ...

Get Deep Learning with R Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.