# Model Description
This model detects dogs in images and categorizes them into small, medium, and large based on the average weight of an adult of that breed. The weight classes generally follow: less than 30lbs for small dogs, between 30 lbs and 50lbs for medium dogs, and greater than 50lbs for large dogs.
Training was done by fine-tuning the YOLOv11 model. Due to the large physical differences between dog breeds, this model is intended to be used to determine counts of each type to better meet the needs of the group in the area.
***
# Training Data
This model is trained using the following Roboflow dataset: [Link](https://universe.roboflow.com/igor-romanica-gmail-com/stanford-dogs-0pff9).
The Roboflow page is using a subset of the [Stanford Dogs Dataset](http://vision.stanford.edu/aditya86/ImageNetDogs/). The subset consists of images of 60 breeds across 9884 images, about half the breed and image count of the original dataset.
Annotations included manually sorting each of the 60 breeds into a category based on weight (as detailed above). Additionally, some classes were deleted due to the large weight ranges of the breed. For example, [Xoloitzcuintles](https://en.wikipedia.org/wiki/Xoloitzcuintle) are usually broken into three sub-breeds with different sizes, but they are labeled in the dataset under one category.
### *Class Breakdown*
| Metric | Large | Medium | Small |
|--------|--------|----------|------ |
| Percent | 39% | 37% | 24% |
| Count | 4,058 | 3,860 | 2,524 |
### *Training Split*
| Metric | Train | Validate | Test |
|--------|--------|----------|------|
| Percent| 87% | 8% | 4% |
| Count | 20,731 | 1,975 | 988 |
***
# Training Prcedure
* Trained on Google Collab using A100
* Limited to 200 epochs and 100 patience
* Ran for 73 epochs, best at 63
* 4.9 hours of training on ~24k images
* 10k base
* 14k augmented on exposure and blur
***
# Evaluation Resuls
### *Comprehensive Metrics*
| Metric | Goal | Result |
|--------|--------|----------|
|F1 Score | .75 < | .84 |
|Recall | .75 < | .96 |
|Precision | .80 < | 1.0 |
### *Detailed Per-Class Breakdown*

Less than a .04 difference between classes for each metric.
### *Examples Of Classes*

### *Visualizations*
### *Performance Analysis*
This model had high metrics across each of the classes, meeting the success threshold in precision, recall, and F1 score. The confusion matrix shows some slight overguessing, as each of the classes had a 25% to 40% rate of being predicted when that area was actual background. The model also predicted small dogs as large dogs 10% of the time, which was right at the limit set before training. That being said, the matrix still has high values of 80%-85% along the true positive diagonal. The 100% precision peak at 100% confidence does raise some red flags. This is addressed in the *Known Failure Cases* section.
***
# Limitations and Biases
### *Known Failure Cases*
After testing with images outside the training set, a pattern emerged where the model would perform well but consistently made mistakes on the same breeds (seen in the image above). This is because these breeds were not in the original training data.
### *Poor performing classes*
There was a less than 5% difference between class performance. The class imbalance, with small breeds having over 1k fewer images than other classes, may have contributed to the relatively high (10%) confusion rate between large and small breeds.
### *Data biases & Environmental/contextual limitations*
The images found in the dataset varied across different conditions as well as environmental situations.
### *Inappropriate use cases*
This model has high accuracy and precision across the breeds found in the dataset but performs poorly on those not found in the set. Additionally, this model produces a relatively high rate of false positives. With this in mind, the model should not be used when specific counts are required or when it is unknown what types of breeds will be present. Instead, this model should be used to get general counts, especially in comparison to one another, when the desired breeds are accounted for in the dataset.
### *Sample size limitations*
The main limitations come from the lack of some breeds in the original set, as well as the imbalance between the classes. The former could be fixed by adding more images of other breeds, while the latter could be fixed by adjusting the weight ranges to even out the classes.