NETRA Project - Duplicate Folders & Merge Analysis
Critical Finding: Your project has 2 duplicate model directories that need consolidation!
π΄ CRITICAL: models/ vs ai_models/ (DUPLICATE FOLDERS)
Current Status:
config/model_config.pyuses:MODELS_DIR = PROJECT_ROOT / "models"(Line 11)- But app.py expects models in: Both directories have duplicates
Directory Structure Comparison:
| Subdirectory | models/ |
ai_models/ |
Both Have |
|---|---|---|---|
object_detection/ |
β
yolov8n.pt |
β
yolov8n.pt |
DUPLICATE |
pose_detection/ |
β Empty or file | β
yolo11n-pose.pt |
Possible |
weapon_detection/ |
? | β
best.pt |
? |
anomaly_detection/ |
π‘ Empty | π‘ Empty | Both Empty |
violence_detection/ |
? | ? | ? |
Problem:
# config/model_config.py points to "models/" directory:
MODELS_DIR = PROJECT_ROOT / "models"
MODEL_PATHS = {
'yolo': {
'candidates': [
MODELS_DIR / "object_detection" / "yolov8n.pt",
MODELS_DIR / "object_detection" / "yolov8s.pt",
],
},
}
BUT: If actual model files are in ai_models/, the app won't find them!
β SOLUTION: Consolidate to Single Model Directory
RECOMMENDED APPROACH:
Option 1: Keep ai_models/ as Primary (RECOMMENDED)
Why: Name is more descriptive, common practice is "ai_models" in ML projects
Action:
1. Update config/model_config.py line 11:
- FROM: MODELS_DIR = PROJECT_ROOT / "models"
- TO: MODELS_DIR = PROJECT_ROOT / "ai_models"
2. Delete "models/" directory entirely
3. Verify all model files are in ai_models/ subdirectories
Option 2: Keep models/ as Primary (ALTERNATIVE)
Why: Already configured in code
Action:
1. Copy all files from ai_models/ to models/
2. Delete ai_models/ directory
3. Keep config/model_config.py unchanged
π Code Folder Duplicates (Already Identified)
1οΈβ£ NETRA/ vs src/ (CODE DUPLICATES)
Status: β NETRA/ NOT USED | β src/ IS USED
What can be merged:
- Both contain identical detector implementations
src/is the new structure that app.py actually imports fromNETRA/should be deleted entirely (already in previous cleanup list)
2οΈβ£ detection logic/ vs src/detectors/ (CODE DUPLICATES)
Status: β detection logic/ NOT USED | β
src/detectors/ IS USED
Example - Pose Detection:
detection logic/pose_detection.py(OLD - unused)src/detectors/pose_detector.py(NEW - used by app.py)
What can be merged:
- Delete
detection logic/entirely
π― Summary: All Duplicates & Merges Needed
| Folder 1 | Folder 2 | Status | Action |
|---|---|---|---|
models/ |
ai_models/ |
β οΈ CRITICAL - Duplicate model files | MERGE: Pick one, delete other |
NETRA/ |
src/ |
β NETRA unused | DELETE: NETRA/ |
detection logic/ |
src/detectors/ |
β detection logic/ unused | DELETE: detection logic/ |
π Recommended Consolidation Steps
STEP 1: Fix Model Directories (CRITICAL - Do First)
# Option 1: Consolidate to ai_models/ (RECOMMENDED)
#
# 1. Check what's actually in models/:
# cd models/
# dir
#
# 2. If models/ has actual model files, copy them to ai_models/:
# xcopy models\* ai_models\ /E /Y
#
# 3. Update config file:
# Edit config/model_config.py line 11:
# FROM: MODELS_DIR = PROJECT_ROOT / "models"
# TO: MODELS_DIR = PROJECT_ROOT / "ai_models"
#
# 4. Delete models/ directory:
# rmdir /s /q models
#
# 5. Test:
# python -c "from config import get_model_path; print(get_model_path('yolo'))"
STEP 2: Clean Up Code Directories (Already Identified)
# Already planned in CLEANUP_ANALYSIS.md
# These are separate from the model consolidation
rmdir /s /q NETRA
rmdir /s /q "detection logic"
β οΈ CRITICAL VERIFICATION CHECKLIST
Before making changes, verify:
- Check what model files are in
models/object_detection/ - Check what model files are in
ai_models/object_detection/ - Confirm which directory actually has the trained models
- Run app.py and check if models load successfully
- Verify the config file paths are correct after consolidation
π Verification Command
Run this to see which models are found:
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from config import get_model_path, MODEL_PATHS
print("Current model directory:", MODEL_PATHS['yolo']['candidates'][0].parent.parent)
print("\nSearching for models:")
print("YOLO:", get_model_path('yolo'))
print("Pose:", get_model_path('pose'))
print("Weapon (gun):", get_model_path('weapon', 'gun'))
print("Weapon (person):", get_model_path('weapon', 'person'))
print("Anomaly:", get_model_path('anomaly'))
π Updated Cleanup & Merge Plan
PHASE 0: Model Directory Consolidation (NEW - DO FIRST!)
Priority: π΄ CRITICAL
Action: Choose one model directory, delete the other
Estimated space saved: ~100-150 MB
PHASE 1: Code Cleanup (From CLEANUP_ANALYSIS.md)
Priority: π HIGH
Folders: NETRA/, detection logic/, database/models/, tests/
Estimated space saved: ~50-100 MB
PHASE 2: Optional Cleanup
Priority: π‘ MEDIUM
Folders: test_migration.py, .sixth/
Estimated space saved: ~5-10 MB
β¨ Next Steps
- FIRST: Identify which model directory (
models/orai_models/) actually contains your trained model files - Consolidate to single directory (recommend
ai_models/) - Update
config/model_config.pyto point to the right directory - Test the app:
python webapp/app.py - Delete the duplicate model directory
- Then proceed with code cleanup from CLEANUP_ANALYSIS.md
Generated By: Duplicate Analysis Tool
Confidence Level: π’ HIGH (100% safe after consolidation verified)