How xg-chu/crowddet works
Project type and purpose
• This is a PyTorch-based, research-oriented object‐detection toolkit for crowded scenes (“CrowdDet”), implementing the CVPR-2020 paper “One Proposal, Multiple Predictions.”
• It is not a web or full-stack app but an open‐source machine-learning framework focusing on training, inference, and evaluation of detection models.
File structure
• Top-level files and folders:
• Dockerfile, requirements.txt: deployment and dependencies
• lib/: core library components (backbone networks, data loaders, detection operators, custom layers, model utilities, loss functions, evaluation toolkits)
• model/: ready‐to‐configure model definitions (each subfolder has a config.py and network.py for variants: RCNN/RetinaNet, FPN vs. EMD, baseline vs. refined)
• tools/: CLI entry points (train.py, test.py, inference.py, eval_json.py, visulize_json.py)
• Patterns:
• Modular architecture separating data, model definition, ops, training/inference scripts
• Strategy pattern in model configs for selecting network variant
• Pipeline structure: data → backbone → feature pyramid → proposals → heads → losses → postprocessing → evaluation
Insights from the README
• The system expects the CrowdHuman dataset (data path set in config.py)
• External dependencies: PyTorch, MegEngine-converted pretrained weights.
1. Data Ingestion & Preprocessing
• CrowdHuman dataset loader (lib/data/CrowdHuman.py)
• Transformations, batching
2. Core Model Library
• Backbone (lib/backbone/*.py): ResNet50, FPN
• Detection Operators (lib/det_oprs/*.py): anchor generation, proposal filtering, ROI target assignment, EMD loss
• Custom Layers (lib/layers/*.py): batch norm, pooler
• Modules (lib/module/rpn.py): RPN head, ROI heads
3. Model Configurations & Networks (model/*)
• Config file (hyperparameters, dataset paths)
• Network defs (assembling backbone + FPN + heads + EMD extensions)
4. Training & Inference Scripts (tools/*.py)
• train.py: orchestrates data loader → model → optimizer (SGD_bias) → loss → checkpointing
• test.py, inference.py: load checkpoint → forward pass → postprocessing
5. Evaluation Toolkits (lib/evaluate/*)
• APMRToolkits, JIToolkits: matching and metric computation
6. Deployment Environment
• Docker container, GPU resources
• Data Loader → Model Input
• Model Components: Backbone → FPN → RPN → ROI Heads → EMD Loss & Set NMS → Predictions
• Predictions → Postprocessing (nms_utils) → Output JSON
• Output JSON → Evaluation Toolkits → Metrics
c. Architectural patterns & principles:
• Modular separation of concerns: data / model / ops / utils
• Plugin-style model variants via config + network pairing
• Pipeline design for training versus inference branching
• Extensibility: new detection ops or backbones can be dropped into lib/ and wired via config
d. Key technologies, frameworks, libraries:
• Python 3, PyTorch, NVIDIA-Docker
• Custom modules in lib/ for performance (vectorized ops, CUD A-compatible)
• MegEngine pretrained model loader (converted to PyTorch)