Very few positive images
Only 19 positive examples appeared in the original training split. Learning directly from scratch would be difficult and prone to overfitting.
Can a pretrained vision network identify one particular dog from a small set of photographs? This case study explores individual-animal recognition through VGG16 transfer learning, a new binary classifier and staged fine-tuning.

Most general-purpose image classifiers learn categories such as “dog” or “cat.” Here the target is more specific: telling one known dog apart from other images.
Only 19 positive examples appeared in the original training split. Learning directly from scratch would be difficult and prone to overfitting.
Use patterns learned on ImageNet rather than training millions of convolutional parameters from random initialization.
One missed sample changes validation accuracy by 3.33 percentage points. Class-specific metrics and a fresh test set matter.
The original educational “Presidential Doggy Door” exercise distinguishes Bo from other images. Counts below are from the supplied exercise, not from a new training run.
Illustrated bars show class proportions, not model performance. Example photographs illustrate the intended classes, not actual model predictions.
The target identity is strongly underrepresented. Accuracy alone may hide mistakes on the minority class, so precision, recall and F1 are important additions.
VGG16 acts as a feature extractor. A new small classifier learns the task-specific distinction between the target animal and other images.
Conceptual illustration, not a layer-by-layer tensor specification. The new repository uses PyTorch and TorchVision.
Training a small classifier first reduces unnecessary changes to pretrained features. Fine-tuning then adapts the final convolutional block more cautiously.
Initialize VGG16 from ImageNet-pretrained weights.
Freeze convolutional features and learn the binary classifier.
Unfreeze the final feature block and train at a lower learning rate.
Track validation loss and class-specific metrics; save the best checkpoint.
The educational notebook reported 29 correct predictions on a 30-image validation set. This result is not a benchmark for the cleaned PyTorch implementation.
■ 29 correct■ 1 incorrect
Each square represents one validation prediction. The incorrect sample's class is unknown from this summary, so this is not a confusion matrix.
The repository includes a command-line predictor that loads a trained checkpoint and returns scores for both classes.
After training, pass a new image to the model. The output contains the predicted label and two class scores. Scores are not calibrated confidence measures.
python -m dog_identity.predict --image path/to/photo.jpg --checkpoint models/best_model.ptNo example prediction is shown because the clean implementation has not been trained with a verified dataset.







These are labeled example photos, not outputs from a trained model.
The public repository is a new modular implementation inspired by the training exercise, not a redistribution of the original notebooks.
Pretrained convolutional features are reused to support learning with a small image dataset.
Classifier training followed by controlled fine-tuning of the last feature block.
Compute precision, recall and F1 alongside accuracy, reducing reliance on a single number.
Command-line entry points keep training and single-image inference independent.
Save the lowest-validation-loss checkpoint and keep epoch-level history locally.
Original course images and proprietary teaching materials are not included in the public repository.
Training, prediction, tests and documentation are available in the public-facing code package. The link will work after the repository is published.
Its strongest portfolio value lies in the decisions around data scarcity, pretraining and honest model evaluation—not in a single validation accuracy figure.
A high accuracy number is meaningful only alongside the data and protocol that produced it. Transfer learning can make small-data experiments feasible, but careful validation is what makes their conclusions credible.
Features learned on ImageNet provide a useful starting point even when the downstream problem is identifying one individual animal.
Training a new head before unfreezing higher-level features gives control over how much of the pretrained network changes.
With fewer examples of the target class, overall accuracy may obscure low recall or high false-positive rates.
Transforming notebook logic into modules, tests and documented commands creates a clearer, more maintainable codebase.
This project is an educational study in binary visual classification. Reliable real-world identity recognition would need broader data, evaluation and an ability to reject unknown inputs.
Fresh PyTorch code, a VGG16 binary head, staged fine-tuning, training metrics, checkpoint saving and CLI inference. Original notebook results are explicitly labeled as historical.
Collect licensed samples, use an independent test split, check duplicate leakage, compare with smaller backbones, repeat across seeds and introduce a reject/unknown option.