Skip to content

Commit

Permalink
refactor!: move yolov8custommodel to top level of project
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzzy committed Oct 13, 2024
1 parent 6ed5896 commit 03d9d7c
Show file tree
Hide file tree
Showing 373 changed files with 6,857 additions and 0 deletions.
18 changes: 18 additions & 0 deletions model/detect/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# config.yaml
optimizer: AdamW
epochs: 50
batch_size: 16
imgsz: 640
learning_rate: 0.002
momentum: 0.937
weight_decay: 0.0005
augmentation:
flip_lr: 0.5
mosaic: 1.0
mixup: 0.0
hsv_h: 0.015
hsv_s: 0.7
hsv_v: 0.4
degrees: 5
translate: 0.1
scale: 0.5
10 changes: 10 additions & 0 deletions model/detect/data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
path: data

# data.yaml
train: images/train # Path to training dataset
val: images/val # Path to validation dataset

nc: 1 # Number of classes (update as per your classes)
names:
["car"]
# Update with class names
54 changes: 54 additions & 0 deletions model/detect/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from torchvision import transforms
from ultralytics import YOLO

# Configuration for data augmentation
transform = transforms.Compose(
[
transforms.RandomHorizontalFlip(p=0.5),
transforms.ColorJitter(brightness=0.4, contrast=0.4, saturation=0.4, hue=0.1),
transforms.RandomRotation(degrees=5),
transforms.RandomResizedCrop((640, 640), scale=(0.8, 1.2)),
]
)


def train_model():
# Initialize YOLO model with pretrained weights
model = YOLO(
"yolov8n.yaml"
) # You can use yolov8n.pt if you want to use the pretrained model

# Update training settings in model
model.train(
data="data.yaml",
epochs=100, # Increase epochs to 100 for better training
batch=8, # Use batch size of 8 to avoid NMS time limit issues
imgsz=512, # Reduce image size to 512x512 for faster training
optimizer="AdamW", # AdamW optimizer for improved convergence
lr0=0.0015, # Fine-tune the learning rate for smoother learning
lrf=0.005, # Adjust learning rate final value for slower decay
momentum=0.9, # Momentum for better optimization
weight_decay=0.0001, # Lower weight decay to prevent over-regularization
augment=True, # Enable augmentation for better generalization
mosaic=1.0, # Mosaic augmentation to improve robustness
mixup=0.2, # Introduce MixUp data augmentation
hsv_h=0.015, # Adjust HSV for more varied color augmentation
hsv_s=0.7,
hsv_v=0.4,
degrees=10, # Increase the rotation degrees to allow more flexibility
translate=0.2, # Allow higher translation augmentation
scale=0.6, # Slightly higher scaling range for augmentation
flipud=0.1, # Flip images upside down 10% of the time
fliplr=0.5, # Left-right flip augmentationn m
max_det=1000, # Allow up to 1000 detections to handle crowded scenes
patience=50, # Early stopping patience to avoid overfitting
project="runs/detect",
name="train_augmented_tuned", # Updated name to reflect fine-tuning
workers=4, # Keep a lower number of workers for better resource management
amp=True, # Re-enable mixed precision to speed up training
verbose=True, # Display progress logs during training
)


if __name__ == "__main__":
train_model()
4 changes: 4 additions & 0 deletions model/detect/obj.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
classes = 1
train = data/train.txt
names = data/obj.names
backup = backup/
1 change: 1 addition & 0 deletions model/detect/obj.names
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
car
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
0 0.585349 0.794940 0.060031 0.112713
0 0.420445 0.411245 0.017536 0.021583
0 0.740474 0.847694 0.077563 0.086333
0 0.907740 0.799134 0.085656 0.101917
0 0.386383 0.481986 0.019557 0.035972
0 0.397510 0.426231 0.016188 0.027574
0 0.453492 0.404051 0.012141 0.016787
0 0.503065 0.709806 0.051932 0.093519
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
0 0.372557 0.278153 0.033719 0.064750
0 0.590070 0.113282 0.016859 0.025176
0 0.598164 0.134866 0.022255 0.034769
0 0.802523 0.416042 0.108589 0.215824
0 0.635935 0.407051 0.054630 0.082731
0 0.655831 0.260764 0.036422 0.056361
0 0.654143 0.172634 0.024953 0.035972
0 0.595466 0.231389 0.024953 0.047963
0 0.619409 0.185824 0.028328 0.038370
0 0.384023 0.192421 0.025630 0.034769
0 0.411339 0.138463 0.023604 0.034778
0 0.347266 0.160648 0.026302 0.033574
0 0.320961 0.398056 0.047891 0.067148
0 0.022513 0.661245 0.044516 0.135491
0 0.232945 0.612685 0.058005 0.091130
0 0.206302 0.504769 0.066771 0.122296
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
0 0.207297 0.359104 0.031469 0.034792
0 0.534625 0.375917 0.035062 0.037167
0 0.266625 0.344729 0.027875 0.032375
0 0.870063 0.558771 0.101625 0.103125
0 0.919516 0.862125 0.160969 0.235000
0 0.702781 0.854917 0.268875 0.290167
0 0.597578 0.380083 0.045844 0.052750
0 0.492812 0.392083 0.039562 0.040750
0 0.418172 0.364500 0.026969 0.033583
0 0.446047 0.486813 0.082719 0.103125
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
0 0.676740 0.526352 0.152427 0.227815
0 0.297018 0.499972 0.068797 0.098315
0 0.230922 0.267958 0.032375 0.037176
0 0.395151 0.350690 0.053281 0.087528
0 0.434607 0.324912 0.041818 0.059954
0 0.515878 0.493375 0.078911 0.130694
0 0.941898 0.803329 0.116203 0.196639
0 0.335461 0.255370 0.033724 0.057556
0 0.318599 0.193019 0.024281 0.033574
0 0.343893 0.145056 0.022255 0.043167
0 0.316914 0.159449 0.019557 0.035972
0 0.267677 0.148653 0.023604 0.035972
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0 0.481563 0.500604 0.035062 0.039542
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
0 0.690904 0.441819 0.047214 0.089935
0 0.615701 0.376472 0.045193 0.091130
0 0.810281 0.887264 0.091729 0.175065
0 0.376268 0.644458 0.060026 0.123509
0 0.258234 0.783551 0.069469 0.178657
0 0.357044 0.254171 0.031026 0.064750
0 0.429885 0.181625 0.026979 0.053954
0 0.386039 0.174454 0.022922 0.039611
0 0.401224 0.139079 0.024948 0.035935
0 0.443036 0.119278 0.023604 0.039574
0 0.624138 0.054537 0.016203 0.027593
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
0 0.309833 0.780551 0.098469 0.244602
0 0.662576 0.580912 0.101172 0.173861
0 0.310844 0.320718 0.053281 0.087528
0 0.403919 0.210407 0.033047 0.046759
0 0.440341 0.187625 0.035745 0.049157
0 0.378964 0.148056 0.023604 0.039574
0 0.411003 0.148056 0.012141 0.037167
0 0.387393 0.109088 0.025630 0.035972
0 0.356708 0.105486 0.012812 0.031176
0 0.349284 0.068310 0.016849 0.028750
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
0 0.520602 0.360287 0.029005 0.051556
0 0.533078 0.256569 0.016187 0.026380
0 0.454841 0.258968 0.006745 0.026380
0 0.429885 0.258963 0.024281 0.033574
0 0.644365 0.243977 0.013490 0.029972
0 0.606932 0.270356 0.016865 0.029972
0 0.412349 0.275755 0.013490 0.031176
0 0.509810 0.279352 0.016859 0.033574
0 0.489240 0.266157 0.016188 0.028778
0 0.464284 0.308727 0.029672 0.044361
0 0.513518 0.326713 0.025630 0.039574
0 0.468669 0.383065 0.041141 0.046759
0 0.548591 0.442417 0.043161 0.067148
0 0.625479 0.943620 0.118708 0.091130
0 0.644701 0.661241 0.089703 0.133093
0 0.513857 0.591097 0.058682 0.098324
0 0.470016 0.470597 0.022260 0.056361
0 0.338161 0.345296 0.032375 0.047963
0 0.205292 0.251171 0.035073 0.044361
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
0 0.478516 0.537023 0.051260 0.073139
0 0.479187 0.485463 0.016188 0.056352
0 0.500435 0.478273 0.031703 0.049157
0 0.310911 0.421917 0.016865 0.039574
0 0.337216 0.455491 0.026307 0.046759
0 0.376672 0.420718 0.032375 0.063546
0 0.408034 0.417120 0.023609 0.041963
0 0.443107 0.417722 0.030349 0.033574
0 0.459966 0.439903 0.023609 0.032380
0 0.446815 0.453093 0.014839 0.046759
0 0.578672 0.442903 0.037094 0.055157
0 0.627570 0.453088 0.048557 0.063546
0 0.657583 0.451894 0.026302 0.044361
0 0.329122 0.402731 0.018214 0.039574
0 0.395555 0.390144 0.020234 0.026380
0 0.513586 0.393741 0.022932 0.038370
0 0.331482 0.927083 0.130849 0.145833
0 0.588789 0.882347 0.204359 0.233806
0 0.813047 0.948296 0.171313 0.099519
0 0.858911 0.584986 0.067448 0.075546
0 0.917250 0.581986 0.069469 0.069546
0 0.752008 0.551412 0.065422 0.087528
0 0.790792 0.494458 0.056656 0.067139
0 0.393870 0.463282 0.034396 0.064750
0 0.611044 0.591579 0.078911 0.093528
0 0.529099 0.629347 0.079583 0.101917
0 0.430292 0.631148 0.066771 0.095926
0 0.324401 0.616162 0.082958 0.207435
0 0.268422 0.543019 0.045187 0.075537
0 0.399940 0.502852 0.033047 0.057556
0 0.429953 0.508843 0.018885 0.057556
0 0.523031 0.511241 0.026979 0.047963
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
0 0.403648 0.755847 0.102516 0.184657
0 0.548659 0.334384 0.055307 0.063546
0 0.282919 0.181505 0.020234 0.045565
0 0.369924 0.089796 0.017536 0.027556
0 0.960143 0.880551 0.079714 0.189454
0 0.463000 0.091579 0.013490 0.026380
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0 0.321672 0.327208 0.089031 0.123500
0 0.497031 0.447125 0.107000 0.219417
0 0.448016 0.110208 0.043156 0.058750
0 0.503328 0.073021 0.040469 0.032375
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
0 0.165565 0.282227 0.036422 0.059954
0 0.109586 0.258245 0.025630 0.035972
0 0.127122 0.201292 0.022932 0.053954
0 0.160844 0.220477 0.020229 0.037176
0 0.177706 0.206685 0.017536 0.028778
0 0.154102 0.197694 0.017536 0.029981
0 0.323052 0.274435 0.033052 0.041963
0 0.195578 0.394338 0.042490 0.058750
0 0.600591 0.807407 0.134891 0.194241
0 0.702099 0.659329 0.099146 0.130694
0 0.825523 0.625153 0.095099 0.124694
0 0.469411 0.423116 0.064073 0.087528
0 0.358461 0.234264 0.025630 0.035972
0 0.362844 0.259449 0.034396 0.040769
0 0.336880 0.255852 0.024281 0.038370
0 0.518646 0.414120 0.055979 0.081537
0 0.583729 0.430310 0.056656 0.063546
0 0.499422 0.318796 0.059354 0.085130
0 0.416802 0.322398 0.019562 0.051556
0 0.427591 0.306810 0.038443 0.049157
0 0.254263 0.305606 0.038453 0.046750
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
0 0.572602 0.269042 0.024953 0.040769
0 0.096771 0.539421 0.078240 0.068343
0 0.209068 0.410528 0.045188 0.047963
0 0.593849 0.204889 0.016187 0.022778
0 0.631956 0.187505 0.016859 0.035972
0 0.606326 0.183907 0.012818 0.028778
0 0.617117 0.219875 0.015516 0.031176
0 0.398930 0.272037 0.028328 0.046759
0 0.584406 0.219880 0.013490 0.028778
0 0.597563 0.240852 0.020917 0.027556
0 0.396568 0.448894 0.065427 0.098324
0 0.616781 0.322995 0.024281 0.038361
0 0.624198 0.296014 0.026979 0.044361
0 0.522693 0.272639 0.023604 0.033574
0 0.580359 0.297815 0.021583 0.043167
0 0.517971 0.354769 0.033047 0.051556
0 0.464688 0.342181 0.034396 0.055157
0 0.328448 0.320000 0.033052 0.032370
0 0.246500 0.407528 0.047208 0.061148
0 0.240430 0.728273 0.099818 0.136694
0 0.342948 0.909926 0.145688 0.161870
0 0.497737 0.561005 0.054630 0.094731
0 0.599581 0.415921 0.050589 0.183454
0 0.472445 0.444097 0.055307 0.062343
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
0 0.457268 0.396736 0.023609 0.027583
0 0.466711 0.444097 0.031703 0.045565
0 0.494365 0.487264 0.034396 0.055157
0 0.567544 0.677310 0.059349 0.087528
0 0.454909 0.529829 0.044516 0.080343
0 0.395219 0.487264 0.035750 0.057546
0 0.427266 0.327806 0.018906 0.021611
0 0.390833 0.322398 0.016188 0.025185
0 0.367904 0.312801 0.012141 0.020380
0 0.291016 0.395537 0.029677 0.044370
0 0.696701 0.525630 0.060026 0.081537
0 0.949966 0.897935 0.090380 0.147481
0 0.387799 0.340977 0.020911 0.026380
0 0.444792 0.366759 0.025625 0.032370
0 0.415792 0.368560 0.024281 0.035972
0 0.363180 0.354171 0.017536 0.031176
0 0.345984 0.461481 0.031698 0.051556
0 0.397917 0.796616 0.066771 0.117509
0 0.482560 0.718079 0.060703 0.111509
0 0.356438 0.393139 0.021583 0.039574
0 0.392859 0.389542 0.026979 0.039565
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
0 0.703448 0.342778 0.026302 0.041963
0 0.603625 0.576593 0.072167 0.118704
0 0.787755 0.715083 0.115333 0.182259
0 0.444792 0.409926 0.044510 0.068352
0 0.466711 0.340981 0.026307 0.047963
0 0.481221 0.300819 0.021599 0.029991
0 0.583393 0.369157 0.018214 0.049167
0 0.575299 0.312204 0.019557 0.031167
0 0.538203 0.294218 0.020906 0.035972
0 0.836315 0.498056 0.054630 0.103111
0 0.966214 0.581398 0.066229 0.123519
0 0.984427 0.693500 0.031146 0.095926
0 0.759427 0.414722 0.047885 0.077944
0 0.824852 0.439903 0.054630 0.073139
0 0.978354 0.537625 0.043292 0.088731
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
0 0.907810 0.522032 0.054630 0.079139
0 0.481885 0.352370 0.024281 0.029981
0 0.498076 0.339778 0.020234 0.033574
0 0.588115 0.463282 0.049240 0.052750
0 0.539216 0.478273 0.047214 0.063546
0 0.696026 0.616759 0.088354 0.122296
0 0.902076 0.921315 0.151078 0.100722
0 0.476828 0.667120 0.093750 0.196648
0 0.722333 0.909921 0.193573 0.135491
0 0.563495 0.414722 0.035073 0.049167
0 0.495039 0.387745 0.031703 0.040769
0 0.456932 0.403329 0.033719 0.040769
0 0.408370 0.402134 0.032375 0.045565
0 0.454573 0.357167 0.029000 0.044370
0 0.416802 0.361366 0.029000 0.045565
0 0.536518 0.385944 0.029672 0.041963
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
0 0.896005 0.577194 0.056656 0.110315
0 0.470083 0.330190 0.030354 0.057546
0 0.428266 0.336185 0.034396 0.059944
0 0.449513 0.256449 0.024276 0.044361
0 0.478852 0.240264 0.020911 0.040769
0 0.509539 0.225875 0.028328 0.045565
0 0.459966 0.213884 0.018214 0.031176
0 0.507180 0.188102 0.018214 0.032370
0 0.468060 0.175514 0.016859 0.021583
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
0 0.527411 0.339782 0.074865 0.095917
0 0.731776 0.460884 0.066771 0.083935
0 0.240768 0.387144 0.038443 0.058750
0 0.337214 0.495060 0.055979 0.077935
0 0.316643 0.348176 0.036422 0.047963
0 0.220872 0.308606 0.031026 0.052750
0 0.201984 0.221676 0.032375 0.053963
0 0.245154 0.216880 0.020234 0.032370
0 0.222893 0.171315 0.017536 0.034778
0 0.196927 0.157523 0.015510 0.026380
0 0.179729 0.173713 0.016187 0.027574
0 0.441419 0.573597 0.060703 0.088731
0 0.302818 0.607167 0.054635 0.103111
0 0.151401 0.629352 0.055302 0.113907
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
0 0.472445 0.303810 0.028328 0.038361
0 0.520669 0.272639 0.022255 0.038370
0 0.528089 0.232468 0.029000 0.063546
0 0.575638 0.246856 0.012141 0.029972
0 0.488969 0.264241 0.022260 0.043167
0 0.502458 0.237264 0.019562 0.034769
0 0.551018 0.214481 0.016859 0.025185
0 0.547310 0.195894 0.020234 0.045565
0 0.563833 0.197694 0.014167 0.037167
0 0.461315 0.333185 0.031703 0.046759
0 0.597896 0.287625 0.024281 0.044361
0 0.556750 0.309806 0.026979 0.062352
0 0.622849 0.390139 0.041812 0.076741
0 0.499424 0.400333 0.039120 0.065944
0 0.439732 0.390144 0.035745 0.074343
0 0.401289 0.934509 0.111286 0.067148
0 0.701760 0.837384 0.128146 0.220620
0 0.591487 0.722875 0.054630 0.121102
0 0.506505 0.461486 0.022260 0.068343
0 0.388138 0.498653 0.058005 0.087528
0 0.315630 0.697699 0.099146 0.125898
Loading

0 comments on commit 03d9d7c

Please sign in to comment.