Skip to content

Latest commit

 

History

History
140 lines (107 loc) · 3.37 KB

File metadata and controls

140 lines (107 loc) · 3.37 KB

Tom and Jerry Classification - Extensible Project Design

This project supports both classical machine learning and deep learning for the Tom and Jerry dataset.

1) Dataset summary

  • Total images: 5478 (1 FPS frames)
  • Original labeled folders:
    • tom: images containing only Tom
    • jerry: images containing only Jerry
    • tom_jerry_1: images containing both Tom and Jerry
    • tom_jerry_0: images containing neither
  • Metadata:
    • ground_truth.csv: frame-level labels (tom, jerry)
    • challenges.csv: difficult/distorted samples for error analysis

Default 4-class classification setup in this repository uses:

  • tom
  • jerry
  • tom_jerry_0
  • tom_jerry_1

2) Default dataset path

data/Tom_and_Jerry_Dataset/tom_and_jerry/tom_and_jerry/

The loader auto-resolves this nested path from data/Tom_and_Jerry_Dataset.

3) Project layout

.
├── configs/
│   ├── deep.yaml
│   ├── classical.yaml
│   └── default.yaml
├── scripts/
│   ├── train.ps1
│   ├── evaluate.ps1
│   ├── predict.ps1
│   ├── build_split.ps1
│   ├── train_classical.ps1
│   ├── predict_classical.ps1
│   └── screen_time.ps1
├── src/
│   ├── data.py
│   ├── model.py
│   ├── train.py
│   ├── evaluate.py
│   ├── predict.py
│   ├── splits.py
│   ├── build_split.py
│   ├── classical_train.py
│   ├── classical_predict.py
│   ├── screen_time.py
│   └── classical/
│       ├── features.py
│       └── models.py
└── outputs/

4) Install

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

5) Deep learning workflow (CNN)

Train:

python -m src.train --config configs/deep.yaml

Evaluate:

python -m src.evaluate --data-dir data/Tom_and_Jerry_Dataset/tom_and_jerry/tom_and_jerry --checkpoint outputs/checkpoints/best.pt

Predict single image:

python -m src.predict --image path/to/image.jpg --checkpoint outputs/checkpoints/best.pt --top-k 3

6) Classical ML workflow (HOG/SIFT + SVM/RF/NB)

Build stratified train/val/test split:

python -m src.build_split --config configs/classical.yaml

Train + evaluate:

python -m src.classical_train --config configs/classical.yaml

Predict single image:

python -m src.classical_predict --image path/to/image.jpg --model outputs/models/classical_model.joblib

7) Screen-time analysis from ground truth

python -m src.screen_time --ground-truth data/Tom_and_Jerry_Dataset/ground_truth.csv

This prints total seconds in 4 states:

  • tom_only
  • jerry_only
  • tom_jerry_1
  • tom_jerry_0

Also prints the longest continuous streak where both Tom and Jerry appear together.

8) Config knobs for extension

  • configs/classical.yaml
    • feature.name: raw | hog | sift
    • model.name: svm | rf | nb
    • use_pca, pca_components
    • split ratios: train/val/test
  • configs/deep.yaml
    • model backbone, image size, epochs, batch size, learning rate

9) Suggested extension direction

  1. Add challenge-set evaluation by filtering images listed in challenges.csv.
  2. Add experiment tracking and confusion-matrix exports under outputs/runs/.
  3. Add model registry and hyperparameter sweep support for reproducible comparisons.