How donaldrr/simplenet works
Main Components
• Data Layer:
• Datasets: The “datasets” folder contains multiple dataset modules (e.g., “btad”, “cifar10”, “mvtec”, “sdd”) that handle loading, processing, and potentially augmentation of image data. These modules abstract the dataset-specific logic.
• Model Architecture:
• Core Model Files: “simplenet.py”, “backbones.py”, “resnet.py”, and “common.py” together define the components of the defect detection network (feature encoder, generator, defect discriminator) as described in the README.
• Execution and Utility:
• “main.py”: Acts as the entry point for training, evaluation, or inference.
• “run.sh”: Provides a shell script to configure dataset paths, log directories, and start the training process.
• “metrics.py” and “utils.py”: Provide essential utilities and evaluation metrics that support the training and performance assessment.
• “Feature Encoder”: Represented by parts of “simplenet.py”, “backbones.py”, and possibly “resnet.py”.
• “Feature Generator”
• “Defect Discriminator”
• “Training & Evaluation”:
• External Components:
• A note for “PyTorch & Torchvision” as the underlying deep learning framework libraries.
• Optionally, include a “Configuration & Execution” block near the periphery to represent “run.sh” which ties together configuration details (like choosing a dataset, setting paths, and logging) and launching the process.
Architectural Patterns and Key Principles
• Modularity: The separation of dataset modules, model definition, and utilities reflects a modular design.
• Pipeline Flow: Emphasize the sequential data flow—from input images through preprocessing, feature extraction, generation, discrimination, and finally evaluation/training feedback.
• Reusability: The use of common components (common.py, utils.py) underscores design for reuse.