From 2b70ff2deb023d92da142c6b2c0fc77da19bc268 Mon Sep 17 00:00:00 2001 From: Abhinav Gupta Date: Wed, 30 Sep 2026 15:20:53 +0530 Subject: [PATCH] feat(weights-docker): track YOLO weights with Git LFS and configure Dockerfile/compose defaults --- .gitattributes | 1 + .gitignore | 11 +- Dockerfile | 6 +- docker-compose.yml | 1 + .../yolo_runs/pid_symbol_detector/args.yaml | 116 ++++++++++++++++++ .../yolo_runs/pid_symbol_detector/results.csv | 51 ++++++++ .../pid_symbol_detector/weights/best.pt | 3 + yolo26n.pt | 3 + yolov8m.pt | 3 + 9 files changed, 191 insertions(+), 4 deletions(-) create mode 100644 .gitattributes create mode 100644 training/outputs/yolo_runs/pid_symbol_detector/args.yaml create mode 100644 training/outputs/yolo_runs/pid_symbol_detector/results.csv create mode 100644 training/outputs/yolo_runs/pid_symbol_detector/weights/best.pt create mode 100644 yolo26n.pt create mode 100644 yolov8m.pt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e92cf9b --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.pt filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index a52c137..4321ff6 100644 --- a/.gitignore +++ b/.gitignore @@ -38,13 +38,20 @@ venv.bak/ # 4. Storage, Temporary Uploads & Output Deliverables # ------------------------------------------------------------------------------ uploads/ -outputs/ +/outputs/ rasterized/ temp/ tmp/ runs/ pid_stuff/ -*.pt + +# Training intermediate plots and caches (preserve weights and configs) +training/outputs/**/*.jpg +training/outputs/**/*.png +training/outputs/**/*.cache +training/outputs/annotations/ +training/outputs/yolo_runs/**/weights/last.pt +training/outputs/yolo_runs/*_run_*/ # ------------------------------------------------------------------------------ diff --git a/Dockerfile b/Dockerfile index 6b4ec19..f8ae412 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,9 +64,10 @@ ENV DEBIAN_FRONTEND=noninteractive \ # Application Paths PATH="/opt/venv/bin:$PATH" \ PYTHONPATH="/app" \ - # Model Cache Locations + # Model Cache & Weights Locations TORCH_HOME="/app/models/torch" \ EASYOCR_MODULE_PATH="/app/models/easyocr" \ + DEFAULT_YOLO_WEIGHTS="/app/training/outputs/yolo_runs/pid_symbol_detector/weights/best.pt" \ # Streamlit Headless Configuration STREAMLIT_SERVER_PORT=8501 \ STREAMLIT_SERVER_ADDRESS=0.0.0.0 \ @@ -104,7 +105,8 @@ RUN mkdir -p \ /app/uploads \ /app/outputs \ /app/models/torch \ - /app/models/easyocr + /app/models/easyocr \ + /app/training/outputs/yolo_runs/pid_symbol_detector/weights # Create a non-root user for security best practices RUN useradd -m -u 1000 -s /bin/bash appuser && \ diff --git a/docker-compose.yml b/docker-compose.yml index 67549fb..1bc5a6c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,6 +25,7 @@ services: # Increase upload limit for high-resolution engineering drawings (in MB) - STREAMLIT_SERVER_MAX_UPLOAD_SIZE=500 - STREAMLIT_BROWSER_GATHER_USAGE_STATS=false + - DEFAULT_YOLO_WEIGHTS=/app/training/outputs/yolo_runs/pid_symbol_detector/weights/best.pt # Allocate 2GB shared memory for PyTorch, EasyOCR, and OpenCV workers # (prevents container crashes during multi-threaded image processing) diff --git a/training/outputs/yolo_runs/pid_symbol_detector/args.yaml b/training/outputs/yolo_runs/pid_symbol_detector/args.yaml new file mode 100644 index 0000000..68c76b8 --- /dev/null +++ b/training/outputs/yolo_runs/pid_symbol_detector/args.yaml @@ -0,0 +1,116 @@ +task: detect +mode: train +model: yolov8m.pt +data: training\outputs\annotations\data.yaml +epochs: 50 +time: null +patience: 0 +batch: 8 +imgsz: 800 +save: true +save_period: -1 +cache: true +device: '0' +workers: 4 +project: C:\Users\ADMIN\Downloads\pid_project\training\outputs\yolo_runs +name: pid_symbol_detector +exist_ok: true +pretrained: true +cls_remap: true +optimizer: auto +verbose: true +seed: 0 +deterministic: true +single_cls: false +rect: false +cos_lr: false +close_mosaic: 10 +resume: false +amp: true +fraction: 1.0 +profile: false +freeze: null +multi_scale: 0.0 +compile: false +channels_last: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +conf: null +iou: 0.7 +max_det: 300 +quantize: null +dnn: false +plots: true +end2end: null +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: true +agnostic_nms: false +classes: null +retina_masks: false +embed: null +show: false +save_frames: false +save_txt: false +save_conf: false +save_crop: false +show_labels: true +show_conf: true +show_boxes: true +line_width: null +format: torchscript +keras: false +optimize: false +dynamic: false +simplify: true +opset: null +workspace: null +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +distill_model: null +dis: 6.0 +box: 7.5 +cls: 0.5 +cls_pw: 0.0 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +rle: 1.0 +angle: 1.0 +dlog: 1.0 +dgrad: 0.5 +dlam: 1.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 5.0 +translate: 0.1 +scale: 0.2 +shear: 2.0 +perspective: 0.001 +flipud: 0.0 +fliplr: 0.3 +bgr: 0.0 +mosaic: 0.8 +mixup: 0.1 +cutmix: 0.0 +copy_paste: 0.0 +copy_paste_mode: flip +auto_augment: randaugment +erasing: 0.4 +cfg: null +tracker: tracktrack.yaml +save_dir: C:\Users\ADMIN\Downloads\pid_project\training\outputs\yolo_runs\pid_symbol_detector diff --git a/training/outputs/yolo_runs/pid_symbol_detector/results.csv b/training/outputs/yolo_runs/pid_symbol_detector/results.csv new file mode 100644 index 0000000..3350a68 --- /dev/null +++ b/training/outputs/yolo_runs/pid_symbol_detector/results.csv @@ -0,0 +1,51 @@ +epoch,time,train/box_loss,train/cls_loss,train/dfl_loss,metrics/precision(B),metrics/recall(B),metrics/mAP50(B),metrics/mAP50-95(B),val/box_loss,val/cls_loss,val/dfl_loss,lr/pg0,lr/pg1,lr/pg2 +1,42.5214,3.76701,6.86001,2.89844,0,0,0,0,3.70254,6.27892,2.92325,9.25e-05,9.25e-05,9.25e-05 +2,78.2928,3.89447,7.10545,2.89244,0,0,0,0,3.67447,6.32142,2.91465,0.000199471,0.000199471,0.000199471 +3,121.793,3.721,6.80779,2.83803,0,0,0,0,3.67447,6.32142,2.91465,0.000302046,0.000302046,0.000302046 +4,168.453,3.75343,6.80375,2.90573,0,0,0,0,3.67148,6.28732,2.93916,0.00031322,0.00031322,0.00031322 +5,205.871,3.77322,7.13975,2.85583,0,0,0,0,3.70639,6.3206,2.96366,0.000306626,0.000306626,0.000306626 +6,239.411,3.68229,6.81598,2.91733,0,0,0,0,3.74801,29.0949,2.9653,0.000300033,0.000300033,0.000300033 +7,283.005,3.53975,5.93783,2.69444,0,0,0,0,3.74801,29.0949,2.9653,0.00029344,0.00029344,0.00029344 +8,323.012,3.51863,5.77844,2.57843,0,0,0,0,3.66942,55.73,2.8062,0.000286846,0.000286846,0.000286846 +9,357.847,3.41462,5.33724,2.52124,0,0,0,0,3.7139,79.7231,2.77174,0.000280253,0.000280253,0.000280253 +10,404.519,3.39754,5.12129,2.47251,0.00057,0.00204,3e-05,0,3.36953,54.7149,2.61626,0.000273659,0.000273659,0.000273659 +11,464.63,3.25881,4.92918,2.34543,0.00057,0.00204,3e-05,0,3.36953,54.7149,2.61626,0.000267066,0.000267066,0.000267066 +12,505.3,3.29578,4.97758,2.3133,0.20191,0.01871,0.00047,0.00016,3.1565,21.0999,2.56801,0.000260473,0.000260473,0.000260473 +13,540.179,3.23689,4.92059,2.24695,0.00032,0.00204,2e-05,1e-05,3.1635,98.9323,2.57421,0.000253879,0.000253879,0.000253879 +14,571.837,3.30909,4.71089,2.23858,0.00022,0.00256,1e-05,0,3.20929,215.278,2.64184,0.000247286,0.000247286,0.000247286 +15,604.724,3.27154,4.58077,2.28385,0.00022,0.00256,1e-05,0,3.20929,215.278,2.64184,0.000240692,0.000240692,0.000240692 +16,653.964,3.21962,4.63242,2.22435,0.1014,0.02436,0.00028,8e-05,3.15792,65.7286,2.4605,0.000234099,0.000234099,0.000234099 +17,696.043,3.06305,4.58814,2.13028,0.10163,0.00769,0.00069,9e-05,3.10103,6.79076,2.35075,0.000227506,0.000227506,0.000227506 +18,745.436,3.05834,4.41219,2.1297,0.00056,0.01947,0.00016,3e-05,3.21475,5.32005,2.30321,0.000220912,0.000220912,0.000220912 +19,804.307,3.14008,4.41507,2.12235,0.00056,0.01947,0.00016,3e-05,3.21475,5.32005,2.30321,0.000214319,0.000214319,0.000214319 +20,853.966,3.1815,4.38667,2.17061,0.00075,0.02459,0.00019,3e-05,3.32908,5.39343,2.38045,0.000207725,0.000207725,0.000207725 +21,880.496,3.0385,4.33259,2.04997,0.00079,0.02868,0.00021,3e-05,3.5421,4.96744,2.62379,0.000201132,0.000201132,0.000201132 +22,908.925,3.06915,4.23227,2.12473,0.00132,0.04534,0.00063,0.00027,3.53218,4.85147,2.65174,0.000194539,0.000194539,0.000194539 +23,954.145,3.03785,4.33042,2.11126,0.00132,0.04534,0.00063,0.00027,3.53218,4.85147,2.65174,0.000187945,0.000187945,0.000187945 +24,1004.84,3.00214,4.23083,2.08713,0.0021,0.05351,0.00135,0.00051,3.53394,4.6816,2.71455,0.000181352,0.000181352,0.000181352 +25,1044.11,2.97388,4.14961,2.10448,0.30165,0.01667,0.00138,0.00053,3.52824,4.74754,2.7032,0.000174758,0.000174758,0.000174758 +26,1079.82,3.01459,4.04203,2.08141,0.20376,0.01667,0.00205,0.00104,3.50102,5.17582,2.72926,0.000168165,0.000168165,0.000168165 +27,1129.27,3.11209,3.99841,2.1242,0.20376,0.01667,0.00205,0.00104,3.50102,5.17582,2.72926,0.000161572,0.000161572,0.000161572 +28,1173.58,3.00297,4.05839,2.17927,0.30109,0.01667,0.00182,0.00093,3.43779,5.45874,2.71702,0.000154978,0.000154978,0.000154978 +29,1209.9,3.05545,4.11078,2.12703,0.30137,0.01667,0.00272,0.00098,3.37193,4.93928,2.66494,0.000148385,0.000148385,0.000148385 +30,1257.28,2.87519,4.09833,2.06618,0.00124,0.03462,0.00277,0.00112,3.34151,4.75123,2.60726,0.000141791,0.000141791,0.000141791 +31,1301.09,2.90223,4.08079,2.04305,0.00124,0.03462,0.00277,0.00112,3.34151,4.75123,2.60726,0.000135198,0.000135198,0.000135198 +32,1353.2,2.9775,4.06386,2.07051,0.00191,0.04534,0.0018,0.00071,3.41859,4.83669,2.56675,0.000128605,0.000128605,0.000128605 +33,1394.15,2.87104,3.90604,2.07059,0.00165,0.04074,0.0015,0.0004,3.42477,4.84214,2.53091,0.000122011,0.000122011,0.000122011 +34,1427.83,2.7069,3.81348,1.94729,0.00221,0.04482,0.00072,0.0003,3.42483,4.78093,2.49651,0.000115418,0.000115418,0.000115418 +35,1475.72,2.68534,3.74832,2.0404,0.00221,0.04482,0.00072,0.0003,3.42483,4.78093,2.49651,0.000108824,0.000108824,0.000108824 +36,1512.07,2.91037,3.82594,1.99608,0.00211,0.04226,0.00063,0.00025,3.39095,4.7911,2.48779,0.000102231,0.000102231,0.000102231 +37,1541.02,2.76447,3.80128,2.05154,0.00241,0.06149,0.00076,0.00031,3.41261,4.74541,2.49843,9.56376e-05,9.56376e-05,9.56376e-05 +38,1573.42,2.73953,3.62826,1.9842,0.20109,0.02692,0.00076,0.00028,3.45525,4.72362,2.51773,8.90442e-05,8.90442e-05,8.90442e-05 +39,1618.38,2.91212,3.76677,2.01833,0.20109,0.02692,0.00076,0.00028,3.45525,4.72362,2.51773,8.24508e-05,8.24508e-05,8.24508e-05 +40,1656.72,2.77453,3.88966,1.97736,0.20134,0.05128,0.00097,0.00028,3.47529,4.75795,2.53246,7.58574e-05,7.58574e-05,7.58574e-05 +41,1703.47,2.7494,3.91997,2.03341,0.00138,0.05845,0.00094,0.00026,3.46564,4.78525,2.54354,6.9264e-05,6.9264e-05,6.9264e-05 +42,1750.05,2.55409,3.77298,1.88444,0.00085,0.05385,0.00075,0.00022,3.42874,4.8041,2.51434,6.26706e-05,6.26706e-05,6.26706e-05 +43,1806.24,2.57899,3.79324,1.98558,0.00085,0.05385,0.00075,0.00022,3.42874,4.8041,2.51434,5.60772e-05,5.60772e-05,5.60772e-05 +44,1850.53,2.56456,3.74076,1.90393,0.00137,0.05845,0.00072,0.0002,3.41555,4.72956,2.5008,4.94838e-05,4.94838e-05,4.94838e-05 +45,1883.83,2.51063,3.73168,1.92698,0.00106,0.04178,0.00063,0.00018,3.40158,4.62745,2.49114,4.28904e-05,4.28904e-05,4.28904e-05 +46,1918.61,2.51795,3.69772,1.95214,0.00113,0.05589,0.00135,0.00036,3.40086,4.58577,2.49364,3.6297e-05,3.6297e-05,3.6297e-05 +47,1966.76,2.52279,3.69925,1.94632,0.00113,0.05589,0.00135,0.00036,3.40086,4.58577,2.49364,2.97036e-05,2.97036e-05,2.97036e-05 +48,2013.85,2.67862,3.73327,1.92959,0.00108,0.05589,0.00166,0.00057,3.39737,4.57655,2.484,2.31102e-05,2.31102e-05,2.31102e-05 +49,2054.77,2.45837,3.63829,1.9452,0.00099,0.05332,0.00164,0.00051,3.39392,4.58869,2.48708,1.65168e-05,1.65168e-05,1.65168e-05 +50,2090.86,2.49418,3.62531,1.93494,0.00128,0.06947,0.00168,0.00045,3.39009,4.5943,2.48689,9.9234e-06,9.9234e-06,9.9234e-06 diff --git a/training/outputs/yolo_runs/pid_symbol_detector/weights/best.pt b/training/outputs/yolo_runs/pid_symbol_detector/weights/best.pt new file mode 100644 index 0000000..3bb7b22 --- /dev/null +++ b/training/outputs/yolo_runs/pid_symbol_detector/weights/best.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1864e6665946bbb57360d707c16d80d9b77df5492ceed1a10b82a567f744e4c0 +size 52073931 diff --git a/yolo26n.pt b/yolo26n.pt new file mode 100644 index 0000000..20f1a4e --- /dev/null +++ b/yolo26n.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b09cc8bf347f0fc8a5f7657480587f25db09b34bf33b0652110fb03a8ad4fef +size 5544453 diff --git a/yolov8m.pt b/yolov8m.pt new file mode 100644 index 0000000..eea2912 --- /dev/null +++ b/yolov8m.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d4a90cdc7a21786cc59cd19778e9eafff836df9e2da32524737c7ee6efe4fe5 +size 52136884