anjali2002 commited on
Commit
03efa53
·
0 Parent(s):

Complete Code

Browse files
.gitattributes ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ *.jpg filter=lfs diff=lfs merge=lfs -text
2
+ *.png filter=lfs diff=lfs merge=lfs -text
3
+ *.pt filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ /dataset
2
+ /venv
3
+ rename.py
4
+ model_training.py
5
+ correction.py
6
+ dataset.zip
7
+
8
+ *.pt
README.md ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # 🍽️ Utensils Object Detection System
3
+
4
+ Welcome to **Utensils Object Detection System** — an end-to-end pipeline that detects Utensils items like plates, glasses, spoons, and forkss using a custom-trained deep learning model.
5
+
6
+ This project was built **from scratch** (no Roboflow or auto-annotation tools!) and demonstrates a full lifecycle: dataset creation, model training, performance evaluation, and an interactive demo app.
7
+
8
+ ---
9
+
10
+ ## 🏗️ Project Overview
11
+
12
+ We set out to solve a real-world problem:
13
+ > _“Can we reliably detect common Utensils items in images, videos, or real-time webcam streams using only a small, custom-labeled dataset?”_
14
+
15
+ To achieve this, we:
16
+ ✅ Collected & annotated a custom dataset (100–500 images)
17
+ ✅ Built a clean Python codebase to handle training, inference, and deployment
18
+ ✅ Delivered an interactive demo using **Streamlit / Flask**
19
+
20
+ ---
21
+
22
+ ## 📁 Project Structure
23
+
24
+ ```
25
+ ├── app/ # Streamlit or Flask app for demo
26
+ │ └── app.py
27
+ ├── dataset/ # Custom dataset (images + labels)
28
+ │ ├── images/
29
+ │ └── labels/
30
+ ├── inference/ # Inference scripts (image, video, webcam)
31
+ │ ├── detect_image.py
32
+ │ ├── detect_video.py
33
+ │ └── detect_webcam.py
34
+ ├── runs/detect/ # Training results & saved weights
35
+ │ ├── weights/
36
+ │ ├── results.png
37
+ │ └── Other Metrics ...
38
+ ├── training/ # Training pipeline
39
+ │ ├── train.py
40
+ │ └── model_training.ipynb
41
+ ├── data.yaml # Dataset config
42
+ ├── requirements.txt # Python dependencies
43
+ └── README.md # This file
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 🗂️ Dataset
49
+
50
+ - **Images collected:** Manually photographed or sourced from public domain (Kaggle)
51
+ - **Classes:** Example — plate, fork, spoon, glass
52
+ - **Annotation tool:** [LabelImg](https://github.com/heartexlabs/labelImg)
53
+ - **Format:** YOLO txt labels
54
+
55
+ ---
56
+
57
+ ## 🏋️‍♂️ Model Training
58
+
59
+ - **Framework:** YOLOv8
60
+ - **Training script:** `training/train.py`
61
+ - **Best checkpoint:** `runs/detect/weights/best.pt`
62
+ - **Metrics logged:** loss curves, mAP, precision, recall, F1
63
+
64
+ ---
65
+
66
+ ## 🔍 Inference & Results
67
+
68
+ - Run detection on:
69
+ - Static images → `inference/detect_image.py`
70
+ - Video files → `inference/detect_video.py`
71
+ - Real-time webcam → `inference/detect_webcam.py`
72
+
73
+ - Visual outputs include:
74
+ - Bounding boxes with class names and confidence
75
+ - Confusion matrix
76
+ - Precision-recall, F1 curves
77
+
78
+ ---
79
+
80
+ ## 🌐 Interactive Demo
81
+
82
+ Launch the demo app:
83
+ ```bash
84
+ pip install -r requirements.txt
85
+ streamlit run app/app.py
86
+ ```
87
+
88
+ Features:
89
+ - Upload image or video and get detections
90
+ - View predicted bounding boxes + class names + confidence scores
91
+ - (Optional) Real-time webcam support
92
+
93
+ ---
94
+
95
+ ## 🚀 Getting Started
96
+
97
+ 1️⃣ Clone the repo:
98
+ ```bash
99
+ git clone https://github.com/yourusername/Utensils-object-detection.git
100
+ cd Utensils-object-detection
101
+ ```
102
+
103
+ 2️⃣ Install dependencies:
104
+ ```bash
105
+ pip install -r requirements.txt
106
+ ```
107
+
108
+ 3️⃣ Run training:
109
+ ```bash
110
+ python training/train.py --data data.yaml
111
+ ```
112
+
113
+ 4️⃣ Try inference:
114
+ ```bash
115
+ python inference/detect_image.py --source path/to/image.jpg
116
+ ```
117
+
118
+ 5️⃣ Launch app:
119
+ ```bash
120
+ streamlit run app/app.py
121
+ ```
122
+ Model summary (fused): 92 layers, 25,842,076 parameters, 0 gradients, 78.7 GFLOPs
123
+ Class Images Instances Box(P R mAP50 mAP50-95): 100%|██████████| 3/3 [00:02<00:00, 1.48it/s]
124
+ all 40 40 0.681 0.725 0.731 0.468
125
+ fork 10 10 0.338 0.2 0.265 0.113
126
+ glass 10 10 0.643 0.9 0.888 0.432
127
+ plate 10 10 1 1 0.995 0.833
128
+ spoon 10 10 0.744 0.8 0.776 0.496
129
+ ---
130
+
131
+ ## 📊 Performance
132
+
133
+ | Metric | Value |
134
+ |---------------|----------|
135
+ | mAP@0.5 | 78.0% |
136
+ | mAP@0.5:0.95 | 50.8% |
137
+ | Precision | 85.5% |
138
+ | Recall | 67.5% |
139
+
140
+ > _These numbers are based on our custom dataset; actual results may vary depending on data size and quality._
141
+
142
+ ---
143
+
144
+ ## 💡 Challenges & Learnings
145
+
146
+ - **Challenge:** Small dataset size → risk of overfitting
147
+ - **Solution:** Data augmentation and careful validation splitting
148
+ - **Challenge:** Labeling errors → noisy annotations
149
+ - **Solution:** Manual re-checking of all labels
150
+ - **Challenge:** Real-time inference speed
151
+ - **Solution:** Optimized image preprocessing pipeline
152
+
153
+
154
+ ---
155
+
156
+ ## 🛡️ License & Acknowledgments
157
+
158
+ - Built using open-source tools: [Ultralytics YOLO](https://github.com/ultralytics/yolov5), [Streamlit](https://streamlit.io/)
159
+ - Dataset annotated manually, no pre-annotated sources used
160
+ - No external pre-trained models on non-custom data
161
+
162
+ ---
163
+
164
+ If you like this project, ⭐ the repo and feel free to contribute!
165
+ Happy detecting! 🍳🍴🥄
app/app.py ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+ import cv2
4
+ import numpy as np
5
+ from ultralytics import YOLO
6
+ import tempfile
7
+ import os
8
+ from streamlit.web.bootstrap import run
9
+
10
+
11
+ # Disable file watcher
12
+ os.environ["STREAMLIT_SERVER_ENABLE_FILE_WATCHER"] = "false" # Disable watcher
13
+ os.environ["STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION"] = "false"
14
+ # Configure environment to suppress warnings
15
+ os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
16
+ os.environ["STREAMLIT_WATCHER_TYPE"] = "none"
17
+
18
+ # Load model with caching
19
+ @st.cache_resource
20
+ def load_model():
21
+ return YOLO("best50.pt")
22
+
23
+ # Initialize session state for webcam
24
+ if 'webcam_active' not in st.session_state:
25
+ st.session_state.webcam_active = False
26
+
27
+ # App title and layout
28
+ st.title("Object Detection App")
29
+ st.write("Upload an image/video or use your webcam")
30
+
31
+ # Load model
32
+ model = load_model()
33
+
34
+ # Create tabs for different input sources
35
+ tab_upload, tab_webcam = st.tabs(["Upload Media", "Webcam"])
36
+
37
+ def process_image(img):
38
+ """Process image and return annotated version with results"""
39
+ img_array = np.array(img)
40
+ img_bgr = cv2.cvtColor(img_array, cv2.COLOR_RGB2BGR)
41
+ results = model(img_bgr, conf=0.5, iou=0.4)
42
+ annotated_img = results[0].plot()
43
+ return cv2.cvtColor(annotated_img, cv2.COLOR_BGR2RGB), results
44
+
45
+ with tab_upload:
46
+ uploaded_file = st.file_uploader(
47
+ "Choose an image or video",
48
+ type=["jpg", "jpeg", "png", "mp4", "mov"],
49
+ label_visibility="collapsed"
50
+ )
51
+
52
+ if uploaded_file:
53
+ if uploaded_file.type.startswith('image'):
54
+ # Process image
55
+ image = Image.open(uploaded_file)
56
+ annotated_img, results = process_image(image)
57
+
58
+ # Display side by side
59
+ col1, col2 = st.columns(2)
60
+ with col1:
61
+ st.image(image, caption="Original Image", use_container_width=True)
62
+ with col2:
63
+ st.image(annotated_img, caption="Detected Objects", use_container_width=True)
64
+
65
+ # Show detection results
66
+ st.subheader("Detected Objects:")
67
+ for box in results[0].boxes:
68
+ class_name = model.names[int(box.cls)]
69
+ confidence = float(box.conf)
70
+ if confidence >= 0.5:
71
+ st.write(f"- {class_name} (confidence: {confidence:.2f})")
72
+
73
+
74
+ elif uploaded_file.type.startswith('video'):
75
+ # Process video
76
+ with tempfile.NamedTemporaryFile(delete=False, suffix='.mp4') as tfile:
77
+ tfile.write(uploaded_file.read())
78
+ video_path = tfile.name
79
+
80
+ st.video(video_path)
81
+
82
+ # Process and show output video
83
+ with st.spinner('Processing video...'):
84
+ cap = cv2.VideoCapture(video_path)
85
+ fps = cap.get(cv2.CAP_PROP_FPS)
86
+ width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
87
+ height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
88
+
89
+ output_path = tempfile.NamedTemporaryFile(delete=False, suffix='.mp4').name
90
+ out = cv2.VideoWriter(output_path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (width, height))
91
+
92
+ while cap.isOpened():
93
+ ret, frame = cap.read()
94
+ if not ret:
95
+ break
96
+ results = model(frame)
97
+ annotated_frame = results[0].plot()
98
+ out.write(annotated_frame)
99
+
100
+ cap.release()
101
+ out.release()
102
+
103
+ st.video(output_path)
104
+ os.unlink(video_path)
105
+ os.unlink(output_path)
106
+
107
+ with tab_webcam:
108
+ if st.checkbox("Start Webcam", key="webcam_toggle"):
109
+ st.session_state.webcam_active = True
110
+ st.write("Click below to stop the webcam")
111
+
112
+ cap = cv2.VideoCapture(0)
113
+ frame_placeholder = st.empty()
114
+ stop_button = st.button("Stop Webcam")
115
+
116
+ while cap.isOpened() and st.session_state.webcam_active:
117
+ ret, frame = cap.read()
118
+ if not ret or stop_button:
119
+ st.session_state.webcam_active = False
120
+ break
121
+
122
+ results = model(frame)
123
+ annotated_frame = results[0].plot()
124
+ frame_placeholder.image(
125
+ cv2.cvtColor(annotated_frame, cv2.COLOR_BGR2RGB),
126
+ channels="RGB",
127
+ use_container_width=True
128
+ )
129
+
130
+ if stop_button:
131
+ st.session_state.webcam_active = False
132
+ break
133
+
134
+ cap.release()
135
+ if stop_button:
136
+ st.success("Webcam stopped")
data.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # kitchen.yaml
2
+ path: dataset
3
+ train: images/train
4
+ val: images/test
5
+
6
+ names:
7
+ 0: fork
8
+ 1: glass
9
+ 2: plate
10
+ 3: spoon
inference/detect_image.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import cv2
3
+ import sys
4
+
5
+ # Check for command-line argument
6
+ if len(sys.argv) < 2:
7
+ print("Usage: python detect_image.py <image_path>")
8
+ sys.exit(1)
9
+
10
+ image_path = sys.argv[1]
11
+
12
+ # Load trained model
13
+ model = YOLO("runs/detect/weights/best.pt")
14
+
15
+ # Read image
16
+ frame = cv2.imread(image_path)
17
+ if frame is None:
18
+ print(f"Error: Could not read image at {image_path}")
19
+ sys.exit(1)
20
+
21
+ # Run detection with conf and iou threshold
22
+ results = model(frame, conf=0.5, iou=0.4, imgsz=640, augment=False)
23
+
24
+ # Plot and save results
25
+ annotated_img = results[0].plot()
26
+ cv2.imwrite("output.jpg", annotated_img)
27
+ cv2.imshow("Detection", annotated_img)
28
+ cv2.waitKey(0)
29
+ cv2.destroyAllWindows()
inference/detect_video.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import cv2
3
+
4
+ model = YOLO("runs/detect/weights/best.pt")
5
+ video_path = "test_video.mp4"
6
+
7
+ cap = cv2.VideoCapture(video_path)
8
+ while cap.isOpened():
9
+ ret, frame = cap.read()
10
+ if not ret: break
11
+
12
+ results = model(frame, conf=0.5, imgsz=640, augment=False)
13
+ annotated_frame = results[0].plot()
14
+
15
+ cv2.imshow("Video Detection", annotated_frame)
16
+ if cv2.waitKey(1) == ord('q'): break
17
+
18
+ cap.release()
19
+ cv2.destroyAllWindows()
inference/detect_webcam.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+ import cv2
3
+
4
+ model = YOLO("runs/detect/weights/best.pt")
5
+
6
+ cap = cv2.VideoCapture(0) # 0 = default webcam
7
+ while cap.isOpened():
8
+ ret, frame = cap.read()
9
+ if not ret: break
10
+
11
+ results = model(frame, conf=0.5, imgsz=640, augment=False)
12
+ annotated_frame = results[0].plot()
13
+
14
+ cv2.imshow("Webcam Detection", annotated_frame)
15
+ if cv2.waitKey(1) == ord('q'): break
16
+
17
+ cap.release()
18
+ cv2.destroyAllWindows()
input.jpg ADDED

Git LFS Details

  • SHA256: 4e49a16225bf40b05c434052e42b1066098d4c0fee218d94bc40ed5395bf5825
  • Pointer size: 131 Bytes
  • Size of remote file: 317 kB
output.jpg ADDED

Git LFS Details

  • SHA256: ef3856797e6f675bc39f0a8f8d29b6a461ed3ae04797058a74b7129873dc1e37
  • Pointer size: 132 Bytes
  • Size of remote file: 9.58 MB
requirements.txt ADDED
Binary file (2.29 kB). View file
 
runs/detect/F1_curve.png ADDED

Git LFS Details

  • SHA256: 32a466ab5d303000016fea2df5cb527af531e9e50c57d571b51fceedd59c53ed
  • Pointer size: 131 Bytes
  • Size of remote file: 153 kB
runs/detect/PR_curve.png ADDED

Git LFS Details

  • SHA256: d6113a211bfbd1e1f036674ec0a1ac54a9fd87f5ae056ab02a1add0057c8c5b6
  • Pointer size: 131 Bytes
  • Size of remote file: 156 kB
runs/detect/P_curve.png ADDED

Git LFS Details

  • SHA256: c2c55e5582ccdaec1c2b771d51054f64adfe3efd3567385599efa54c16f2208c
  • Pointer size: 131 Bytes
  • Size of remote file: 136 kB
runs/detect/R_curve.png ADDED

Git LFS Details

  • SHA256: 3991ddc82f0e50723ecbbe4089d403a5235c985f162eed8a438039298741d0ae
  • Pointer size: 131 Bytes
  • Size of remote file: 148 kB
runs/detect/args.yaml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ task: detect
2
+ mode: train
3
+ model: yolov8m.pt
4
+ data: data.yaml
5
+ epochs: 45
6
+ time: null
7
+ patience: 20
8
+ batch: 8
9
+ imgsz: 640
10
+ save: true
11
+ save_period: 10
12
+ cache: false
13
+ device: null
14
+ workers: 8
15
+ project: null
16
+ name: detector2
17
+ exist_ok: false
18
+ pretrained: true
19
+ optimizer: auto
20
+ verbose: true
21
+ seed: 0
22
+ deterministic: true
23
+ single_cls: false
24
+ rect: false
25
+ cos_lr: true
26
+ close_mosaic: 10
27
+ resume: false
28
+ amp: true
29
+ fraction: 1.0
30
+ profile: false
31
+ freeze: null
32
+ multi_scale: false
33
+ overlap_mask: true
34
+ mask_ratio: 4
35
+ dropout: 0.0
36
+ val: true
37
+ split: val
38
+ save_json: false
39
+ conf: 0.25
40
+ iou: 0.7
41
+ max_det: 300
42
+ half: false
43
+ dnn: false
44
+ plots: true
45
+ source: null
46
+ vid_stride: 1
47
+ stream_buffer: false
48
+ visualize: false
49
+ augment: true
50
+ agnostic_nms: false
51
+ classes: null
52
+ retina_masks: false
53
+ embed: null
54
+ show: false
55
+ save_frames: false
56
+ save_txt: false
57
+ save_conf: false
58
+ save_crop: false
59
+ show_labels: true
60
+ show_conf: true
61
+ show_boxes: true
62
+ line_width: null
63
+ format: torchscript
64
+ keras: false
65
+ optimize: false
66
+ int8: false
67
+ dynamic: false
68
+ simplify: true
69
+ opset: null
70
+ workspace: null
71
+ nms: false
72
+ lr0: 0.001
73
+ lrf: 0.01
74
+ momentum: 0.937
75
+ weight_decay: 0.0005
76
+ warmup_epochs: 3.0
77
+ warmup_momentum: 0.8
78
+ warmup_bias_lr: 0.1
79
+ box: 7.5
80
+ cls: 0.5
81
+ dfl: 1.5
82
+ pose: 12.0
83
+ kobj: 1.0
84
+ nbs: 64
85
+ hsv_h: 0.015
86
+ hsv_s: 0.7
87
+ hsv_v: 0.4
88
+ degrees: 0.0
89
+ translate: 0.1
90
+ scale: 0.5
91
+ shear: 0.0
92
+ perspective: 0.0
93
+ flipud: 0.0
94
+ fliplr: 0.5
95
+ bgr: 0.0
96
+ mosaic: 1.0
97
+ mixup: 0.0
98
+ cutmix: 0.0
99
+ copy_paste: 0.0
100
+ copy_paste_mode: flip
101
+ auto_augment: randaugment
102
+ erasing: 0.4
103
+ cfg: null
104
+ tracker: botsort.yaml
105
+ save_dir: runs/detect/detector2
runs/detect/confusion_matrix.png ADDED

Git LFS Details

  • SHA256: e7036f2784deb31f752740ce589364166c5b1f0de93c30ab35d997d1a6d74ca9
  • Pointer size: 131 Bytes
  • Size of remote file: 111 kB
runs/detect/confusion_matrix_normalized.png ADDED

Git LFS Details

  • SHA256: be8be4842215da5fd9ea1ddffe0cac936da688bf21367434d003cc8fa63ba00f
  • Pointer size: 131 Bytes
  • Size of remote file: 131 kB
runs/detect/labels.jpg ADDED

Git LFS Details

  • SHA256: 9f67a1fa5ec886e603e276f31b76de993fa5bc4094a6769a82cc39edd96d7f0c
  • Pointer size: 131 Bytes
  • Size of remote file: 177 kB
runs/detect/results.csv ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 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
2
+ 1,7.75734,1.78036,3.49556,2.01507,0.76609,0.325,0.39437,0.18047,2.10203,10.7005,2.18361,0.0002375,0.0002375,0.0002375
3
+ 2,15.423,1.79302,2.75923,1.85474,0.10526,0.2,0.06603,0.02793,2.87958,125.644,3.0908,0.000486912,0.000486912,0.000486912
4
+ 3,22.8104,1.94713,2.68974,1.95075,0.01597,0.05,0.01305,0.00572,3.23687,10.9756,4.06396,0.000733947,0.000733947,0.000733947
5
+ 4,29.5551,1.9183,2.58979,1.92766,0.00299,0.35,0.00262,0.00088,3.16908,659.959,5.41089,0.000976818,0.000976818,0.000976818
6
+ 5,36.9361,1.96711,2.706,2.00498,0.00173,0.075,0.00086,0.00028,3.3475,inf,5.57994,0.00121377,0.00121377,0.00121377
7
+ 6,43.6503,1.95869,2.6115,1.95863,0.00156,0.125,0.00094,0.00018,4.31249,inf,24.4792,0.00121268,0.00121268,0.00121268
8
+ 7,51.1376,1.96479,2.48776,2.07338,0.25637,0.15,0.00609,0.00189,3.0645,57.6018,4.1836,0.00119651,0.00119651,0.00119651
9
+ 8,58.2241,1.94281,2.37012,2.00123,0.00126,0.075,0.00072,0.00024,3.37767,99.9235,4.77505,0.00117757,0.00117757,0.00117757
10
+ 9,65.4209,1.88106,2.32684,1.99259,0.03353,0.25,0.03108,0.01404,2.58351,18.2153,2.76314,0.00115598,0.00115598,0.00115598
11
+ 10,72.8397,2.012,2.37121,1.9462,0.26343,0.1,0.01193,0.00264,2.86945,180.343,3.25406,0.00113183,0.00113183,0.00113183
12
+ 11,79.8439,1.86117,2.06471,1.84808,0.0904,0.1,0.05516,0.02857,2.77258,15.9436,3.18565,0.00110524,0.00110524,0.00110524
13
+ 12,91.7099,1.70296,2.0259,1.78789,0.6563,0.2,0.25778,0.0981,2.25306,4.36774,2.63195,0.00107634,0.00107634,0.00107634
14
+ 13,99.195,1.80577,2.01447,1.80319,0.46786,0.46085,0.402,0.13204,2.43435,3.47326,2.56699,0.00104527,0.00104527,0.00104527
15
+ 14,106.573,1.7805,2.02751,1.76633,0.36397,0.35,0.35821,0.13186,2.49812,3.8955,2.61041,0.00101219,0.00101219,0.00101219
16
+ 15,114.187,1.79277,1.87168,1.75102,0.47327,0.325,0.40062,0.20824,2.21791,2.76894,2.2815,0.000977251,0.000977251,0.000977251
17
+ 16,126.712,1.86401,2.22416,1.87106,0.34464,0.125,0.24458,0.11386,2.61298,3.79657,2.39263,0.000940625,0.000940625,0.000940625
18
+ 17,134.111,1.79036,2.00106,1.73161,0.46931,0.275,0.24856,0.12475,2.3213,4.52619,2.22079,0.000902492,0.000902492,0.000902492
19
+ 18,141.24,1.71544,1.96843,1.69301,0.34963,0.41783,0.40704,0.24095,1.95451,2.74367,1.92154,0.000863038,0.000863038,0.000863038
20
+ 19,153.147,1.6654,1.83614,1.66695,0.62241,0.3,0.31528,0.13595,2.29612,4.0426,2.32851,0.000822454,0.000822454,0.000822454
21
+ 20,160.716,1.5989,1.68419,1.66531,0.47069,0.15,0.19331,0.08635,2.4992,3.49593,2.48693,0.000780939,0.000780939,0.000780939
22
+ 21,167.696,1.71097,1.80517,1.67909,0.4244,0.6,0.49734,0.24719,1.87494,2.0764,2.03337,0.000738695,0.000738695,0.000738695
23
+ 22,182.047,1.63031,1.75042,1.66501,0.50595,0.55,0.53611,0.28425,1.93364,2.10613,2.06664,0.000695927,0.000695927,0.000695927
24
+ 23,193.937,1.67486,1.71635,1.6886,0.69444,0.375,0.57381,0.36873,1.94534,2.2838,2.0227,0.000652844,0.000652844,0.000652844
25
+ 24,201.92,1.58261,1.65864,1.6307,0.44792,0.375,0.46229,0.32119,1.85533,2.04479,1.97446,0.000609656,0.000609656,0.000609656
26
+ 25,209.38,1.59317,1.66635,1.604,0.51972,0.675,0.68986,0.40141,1.68553,1.80119,1.80373,0.000566573,0.000566573,0.000566573
27
+ 26,222.711,1.60071,1.60139,1.66942,0.61703,0.625,0.68858,0.4174,1.5544,1.79489,1.74148,0.000523805,0.000523805,0.000523805
28
+ 27,237.258,1.54978,1.67005,1.59467,0.6375,0.575,0.67006,0.41696,1.72084,1.65729,1.83008,0.000481561,0.000481561,0.000481561
29
+ 28,244.715,1.54939,1.57594,1.64142,0.65936,0.7,0.71757,0.43896,1.65917,1.61329,1.78028,0.000440046,0.000440046,0.000440046
30
+ 29,252.703,1.46182,1.5317,1.55495,0.54613,0.65,0.66185,0.43019,1.55526,1.46552,1.74899,0.000399462,0.000399462,0.000399462
31
+ 30,260.256,1.44586,1.57444,1.52382,0.66958,0.65,0.69523,0.40794,1.60213,1.43563,1.84778,0.000360008,0.000360008,0.000360008
32
+ 31,267.214,1.47418,1.5533,1.51499,0.74268,0.75,0.77259,0.43295,1.6962,1.4413,1.86702,0.000321875,0.000321875,0.000321875
33
+ 32,280.385,1.51454,1.51662,1.56526,0.76953,0.75,0.79032,0.47132,1.66749,1.42884,1.80474,0.000285249,0.000285249,0.000285249
34
+ 33,294.255,1.40159,1.45345,1.47245,0.78169,0.67774,0.7599,0.48878,1.65617,1.48197,1.76941,0.000250309,0.000250309,0.000250309
35
+ 34,306.081,1.45523,1.42562,1.51033,0.8331,0.71207,0.76877,0.50295,1.6183,1.45446,1.74654,0.000217225,0.000217225,0.000217225
36
+ 35,314.158,1.51728,1.4611,1.53849,0.83402,0.67335,0.7337,0.49892,1.61208,1.43519,1.75238,0.000186158,0.000186158,0.000186158
37
+ 36,322.657,1.52999,1.56233,1.7411,0.75,0.65,0.72847,0.47787,1.61425,1.37957,1.73973,0.00015726,0.00015726,0.00015726
38
+ 37,329.571,1.513,1.49616,1.71639,0.94097,0.65,0.80974,0.53109,1.67459,1.40905,1.73769,0.000130671,0.000130671,0.000130671
39
+ 38,343.315,1.48147,1.45212,1.7249,0.94097,0.675,0.82224,0.4982,1.68408,1.39715,1.73625,0.00010652,0.00010652,0.00010652
40
+ 39,350.613,1.45414,1.34207,1.67427,0.87401,0.675,0.80025,0.49424,1.64481,1.33722,1.73205,8.49262e-05,8.49262e-05,8.49262e-05
41
+ 40,358.163,1.40402,1.34877,1.71041,0.86985,0.675,0.77389,0.48173,1.62943,1.30801,1.72339,6.59937e-05,6.59937e-05,6.59937e-05
42
+ 41,365.091,1.3864,1.35002,1.63678,0.86862,0.675,0.7746,0.47976,1.59893,1.29388,1.71103,4.98152e-05,4.98152e-05,4.98152e-05
43
+ 42,377.869,1.35166,1.30164,1.64118,0.90471,0.675,0.78746,0.50376,1.5849,1.27825,1.69229,3.64693e-05,3.64693e-05,3.64693e-05
44
+ 43,385.314,1.37277,1.2453,1.62867,0.89678,0.675,0.78457,0.49722,1.57498,1.2606,1.67731,2.60212e-05,2.60212e-05,2.60212e-05
45
+ 44,392.27,1.41298,1.27781,1.64009,0.86004,0.675,0.79572,0.50276,1.5718,1.25428,1.67299,1.85216e-05,1.85216e-05,1.85216e-05
46
+ 45,399.724,1.37738,1.28799,1.61474,0.85493,0.675,0.7802,0.50775,1.56201,1.26131,1.67392,1.40072e-05,1.40072e-05,1.40072e-05
runs/detect/results.png ADDED

Git LFS Details

  • SHA256: 610b9989dfa77643a858cada7677eb29297fe8bbfb1b6653fff1eca2a33ac248
  • Pointer size: 131 Bytes
  • Size of remote file: 307 kB
training/model_training.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
training/train.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from ultralytics import YOLO
2
+
3
+ #base model
4
+ model = YOLO("yolov8m.pt") #for better accuracy
5
+
6
+
7
+ model.train(
8
+ data="data.yaml",
9
+ epochs=45, # increased to allow better convergence
10
+ patience=20, # early stopping if no val improvement
11
+ imgsz=640, # image size FOR ACCURACY
12
+ batch=8,
13
+ conf=0.25, # initial THRESHOLD
14
+ name="detector",
15
+ augment=True, # enables data augmentation
16
+ auto_augment='randaugment',# advanced augmentation
17
+ lr0=0.001, # initial learning rate
18
+ cos_lr=True, # cosine learning rate schedule (smoother training)
19
+ save=True,
20
+ save_period=10, # save weights every 10 epochs
21
+ )