How czm369/mixpl works
Project Type and Purpose
• This is a research codebase built on top of the MMDetection (mmdet) library for semi-supervised object detection. Its goal is to implement the “Mixed Pseudo Labels (MixPL)” method—which augments pseudo-labeled data via MixUp and Mosaic and resamples labeled data to improve tail‐class performance—and integrate it seamlessly into the standard detection training and inference workflows.
Top‐Level Architectural Layers
• Configuration Layer (configs/, projects/MixPL/configs/)
• Core Library Layer (mmdet/)
• MixPL‐Specific Modules (projects/MixPL/mixpl.py and utilities under tools/)
• Data Layer (datasets, transforms, samplers under mmdet/datasets)
• Model Layer (backbone, neck, head, losses under mmdet/models)
• Engine Layer (training/inference runner under mmdet/engine)
• Utilities & Deployment (tools/, demo/, docs/, docker/)
Main Components
a. Config Manager
• Loads YAML/Python config files (configs/ and projects/MixPL/configs/)
• Knows hyperparameters for data splits, augmentations, model, optimizer, scheduler
b. Data Pipeline
• Labeled Dataset Loader (COCO, VOC, custom)
• Unlabeled Dataset Loader
• MixPL Augmentor (MixUp + Mosaic transform for unlabeled pseudo-labels)
• Resampler for tail‐class oversampling
• Batch Sampler / DataLoader
c. Pseudo-Label Generator
• Inference pass on current detector → produces pseudo labels for unlabeled images
d. Model
• Backbone (ResNet, Swin, etc.) → Neck (FPN, PAFPN) → Dense / Two‐stage Head
• Losses (classification, bbox, MixPL losses)
e. Training Engine
• Runner orchestrates epoch/iteration loops
• Scheduler, optimizer, hooks (logging, checkpoint, evaluation, mean-teacher hook)
• MixPL hook integrates pseudo-label refresh and mixed data injection
f. Evaluation & Inference
• Standard COCO/VOC metrics modules
• Inference APIs (mmdet/apis/) and demo scripts (demo/)
g. Deployment
• Docker images and entrypoints for serving trained models (docker/serve/)
h. Documentation & Examples
• Jupyter notebooks, docs/, tutorials in demo/, README figures
Component Interactions & Data Flow
• The Config Manager initializes Model, DataPipeline, Engine.
• For each training iteration:
1. Labeled images → standard transforms → model inputs
2. Unlabeled images → pseudo-label inference (via Pseudo-Label Generator) → MixPL Augmentor → mixed batch
3. DataLoader yields mixed batches
4. Model computes detections → Loss computed (MixPL losses incorporated)
5. Engine applies backprop, optimizer, scheduler
6. Periodic Hooks regenerate pseudo-labels, evaluate on validation set, checkpoint model
• For inference: Data → transforms → model → post-processing → results
• External tools (tools/, demo/) consume saved weights and configs for analysis, conversion, or GUI demos.
Architectural Patterns & Principles
• Plugin/Registry Pattern: model, dataset, hook, optimizer constructors are registered for easy extension
• Layered Modularization: clear separation of config, data, model, engine, tools, docs
• Hook System: training behavior (pseudo-label refresh, logging) injected without modifying core runner
• Config‐Driven: behavior is defined in Python/YAML config files, enabling low-code experimentation
• Reuse of MMDetection Core: MixPL overrides or extends only specific parts (augmentor, hook, config)
Technologies & Frameworks
• Python 3.x, PyTorch
• MMDetection core (mmdet)
• Jupyter Notebooks for demos
• Docker for deployment
• YAML/Python‐based configs
• COCO / VOC datasets
• Standard CV libraries (OpenCV, NumPy)