Course Content

Lesson 3.3: Distribution of Objects per Image

Defining Distribution of Objects per Image

Distribution of Objects per Image refers to the count of distinct segmented regions, or objects, identified in each image. This feature provides insights into the complexity of each image in terms of the number of individual regions that the model needs to identify and classify. 

The Importance of the Distribution of Objects per Image

Understanding the distribution of objects per image is essential as it impacts the complexity of the task and potentially the choice or configuration of the model.

Datasets with images having a large number of objects might require more complex models to accurately capture the scene’s intricacies. On the other hand, datasets with a smaller number of objects per image might perform well with simpler models.

Calculating the Distribution of Objects per Image

The Distribution of Objects per Image feature is calculated by iterating through all the samples in the dataset. For each sample, the number of separate segmented regions, or objects, is counted. The count of these regions per image forms the basis of this feature. This data is grouped by each individual sample and the data split (training or validation), generating a count of objects for each image in each split.

Here’s how Distribution of Objects per Image is calculated in DataGradients.

Add Your Heading Text Here
					from transformers import AutoFeatureExtractor, AutoModelForImageClassification

extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-50")

model = AutoModelForImageClassification.from_pretrained("microsoft/resnet-50")