A well-organised, representative dataset is the foundation of any reliable image classifier. For Kermit detection, the model must learn to distinguish frames containing Kermit the Frog from everything else — so both the positive (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ilirosmanaj/detect_kermit/llms.txt
Use this file to discover all available pages before exploring further.
kermit) and negative (no-kermit) classes need enough variety to generalise beyond the training episodes. This guide walks through every step needed to get your image directories into the shape that ImageAI’s ModelTraining API expects.
Directory structure
ImageAI requires a strict folder layout. Create the following tree before running any helper scripts:models/ directory is where the trained .h5 file will be saved after training completes. The json/ directory holds model_class.json, which maps class indices to human-readable labels.
Data sources
Training data was extracted from Muppets episodes 1 and 2. Frames from these episodes are split into thekermit and no-kermit classes. Episode 3 is reserved as the test and validation set, providing a clean, held-out benchmark that the model never sees during training.
The no-kermit class is deliberately diverse to prevent the model from learning superficial shortcuts. It includes images of:
- Green frogs (visually similar to Kermit)
- Human characters from the show
- Nature scenes and backgrounds
- Other Muppet characters
Step-by-step preparation
Extract frames from video
Use See the Video to Frames page for a full breakdown of what this script does.
helpers/convert_vid2image.py to sample one JPEG frame per second from your source .avi video file. The script reads data/video.avi and writes numbered frames to data/videoframe/:Organise frames into class folders
Manually review the extracted frames and move them into the appropriate subdirectories:
- Frames containing Kermit →
data/images/train/kermit/kermit-train-images/ - All other frames →
data/images/train/no-kermit/no-kermit-train-images/
test/ subdirectories.Augment kermit images with rotation
Run See the Rotate Images page for details on how rotations are applied and named.
helpers/rotate_images.py to triple the size of your kermit training set by generating rotated copies of every image:Download supplemental images from Google (optional)
Use See the Download from Google page for configuration options.
helpers/download_from_google.py to pull up to 100 additional Kermit images from Google Images into data/google-images/. Move relevant downloads into your kermit training folder afterwards:Data enrichment via rotation
Therotate_images.py script reads every .jpg in data/images/train/kermit/kermit-train-images/ and produces three additional variants for each original:
| Variant | Rotation | Filename suffix |
|---|---|---|
| Right | 90° | <name>right.jpg |
| Left | −90° | <name>left.jpg |
| 180° | 180° | <name>None.jpg |
Due to their large file sizes, the Muppets
.avi video files are not checked into the repository. Only the helper scripts are version-controlled. You must supply your own video files and run the extraction scripts locally before training.