Spaces:
Sleeping
Sleeping
Commit History
-
fix: pass ruff lint+format, clean README, remove stray script
Priya Monishafa0ce5b -
fix: production audit β security hardening + observability + code qualityβ
Priya MonishaC-1 api/routes/classify.py: add missing logger (was NameError on unknown class) M-1 src/models/base_classifier.py: remove print() β logger.info already covers epoch progress m-1 src/data/dataset.py: assert -> ValueError for invalid split param SEC config.py + redis_cache.py + api/main.py: Redis password support (REDIS_PASSWORD env) SEC docker-compose.yml: conditional Redis auth (no-op when REDIS_PASSWORD empty) SEC docker-compose.airflow.yml: replace hardcoded airflow:airflow/admin:admin with env vars OBS api/prometheus_metrics.py: add http_errors Counter + models_loaded Gauge OBS api/main.py: middleware counts 4xx/5xx; models_loaded.set(1) on successful startup DOC .env.example: document REDIS_PASSWORD, AIRFLOW_DB_PASSWORD, AIRFLOW_ADMIN_PASSWORD6319415
-
results: Section 5 complete β all 4 CNNs trained, ResNet50 best at 65.5%β
Priya MonishaSection 5 final results: - VGG16: 59.5% (architecture ceiling) - MobileNetV2: 56.7% (backbone lr=1e-5 too conservative) - EfficientNetB0: 58.9% (backbone lr=1e-5 too conservative) - ResNet50: 65.5% test / 63.6% val (data volume bottleneck, 1464 params/img) Pipeline improvements committed alongside results: - dataset.py: create_stratified_split() β random stratified resplit, no sequential bias - loader.py: quality gates 48pxβ80px, 2% area; compute_overlap_ratio; check_person_overlap - model_factory.py: unfreeze_efficientnet_phase2() added - 01_data_acquisition.py: chair person-overlap filter, MAX_ITER 80kβ150k Next: Section 6 YOLOv8 detection training1a28594
-
section-5: fix all RCAs (BN stats, ZoomOut order, fc unfreeze, grad_clip, checkpoint format)
Priya Monisha4e27aff
-
section-5: CNN training framework β base_classifier, model_factory, 04_train_classifierβ
Priya Monishasrc/models/base_classifier.py: - train_one_epoch(): single epoch, supports GradScaler for mixed precision (EfficientNet) - evaluate(): accuracy, precision, recall, F1 (macro) via sklearn - train(): full loop with early stopping, saves best state_dict (Rule 5) - save_model() / load_model(): state_dict with weights_only=True (Rule 36) - benchmark_inference(): warmup + timed n=100 runs, returns ms/image src/models/model_factory.py: - get_model(name): vgg16, resnet50, mobilenet, efficientnet β 25-class head - VGG16: features frozen, classifier[-1] replaced (4096β25) - ResNet50: fc replaced (2048β25), caller manages 2-phase freeze/unfreeze - MobileNetV2: features frozen, classifier[-1] (1280β25) - EfficientNetB0: features frozen, classifier[-1] (1280β25) - freeze_resnet50_phase1() / unfreeze_resnet50_phase2() helpers - count_trainable_params() notebooks/04_train_classifier.py: - Parameterized: set MODEL = "vgg16"|"resnet50"|"mobilenet"|"efficientnet", run once each - FAST_MODE=False localβ¦fecb3f1 -
section-2: dataset acquisition β loader, dataset, helpers, 01_data_acquisition notebookβ
Priya MonishaKey corrections from mentor notebook analysis: - config.py: replaced COCO original IDs (1-90) with HF 0-indexed IDs (0-79) via SELECTED_CLASSES dict and HF_CATEGORY_TO_CLASS_IDX reverse mapping - Fixed to 25 classes (mentor's notebook had 26 by accidentally including 'train' vehicle) - Confirmed bbox format: [x,y,w,h] absolute pixels (not [xmin,ymin,xmax,ymax]) - No trust_remote_code needed for detection-datasets/coco src/utils/helpers.py: - NumpyEncoder (torch.Tensor β np.bool_ β np.integer β np.floating β np.ndarray) - save_json/load_json with NumpyEncoder - HF Hub helpers: upload_model_to_hub, download_model_from_hub (HfApi().upload_file) - create_hub_repo with exist_ok=True src/data/loader.py: - verify_coco_mapping() using SELECTED_CLASSES + HF_CATEGORY_TO_CLASS_IDX - Checkpoint/resume (mentor had none β Colab disconnect = start over) - save_classification_crop: [x,y,w,h] β PIL.crop((x,y,x+w,y+h)) β resize 224Γ224 - save_detection_sample: [x,y,w,h] β YOLO normalized format - Prβ¦9b0ae38