How marks0kolov/chimuffnet works
Project type and purpose
• This is a standalone Python-based AI inference tool (“Muffin vs Chihuahua Detector”).
• It loads an ONNX image‐classification model, applies it to one or more input images, and prints out predicted labels with confidence.
File structure
• run_model.py
– Entry point for inference.
– Parses CLI args, loads model + labels, traverses input path, runs inference.
• model/
– model.onnx (trained ResNet-18 fine-tuned for muffin vs chihuahua)
– labels.txt (maps output indices to class names)
• readme_images/
– Documentation assets only (no runtime role)
• README.md, LICENSE, .gitignore
No “build” or “deploy” scripts—this is a simple client tool.
Insights from README
• Describes inference workflow: CLI → ONNX Runtime → label mapping → console output.
• Mentions training was done externally (not in this repo).
• Lists external dependencies: Python3, ONNX Runtime (and optionally NVIDIA Jetson Orin Nano if accelerated).
A. CLI Frontend
• Parses flags: --model, --labels, --input
• Supports single image or batch folder
B. Pre-processing Module
• Reads image file(s)
• Resizes, normalizes pixel values
C. ONNX Inference Engine
• Loads model.onnx via ONNX Runtime
• Executes forward pass to produce raw logits
D. Post-processing Module
• Applies softmax on logits
• Maps top index to human-readable label from labels.txt
E. Output / Reporting
• Prints “Class: X, Confidence: Y” to console
F. External Dependencies (sidepiece)
• Python 3 interpreter
• ONNX Runtime library
• (Optional) GPU / Jetson hardware accelerator
Architectural patterns & principles
• Pipeline pattern: clear separation between stages (ingest → preprocess → infer → postprocess → output).
• Single-responsibility: each module has one clear task.
• Extensibility point: swapping model.onnx for different ONNX models without code change.
Details to capture
• CLI argument parsing (flags)
• Single image vs batch folder loop
• ONNX Runtime load and session creation
• Console output formatting