diff --git a/.gitignore b/.gitignore index 82f9275..f7d3395 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,7 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +dataset/train/images +dataset/train/labels +app_logs.txt +.aider* diff --git a/README.md b/README.md index 53131d3..f98ac50 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ SearchVision is designed to provide a seamless experience for users to perform i ## Contributing We welcome contributions! If you're interested in contributing to SearchVision, please read our [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines on how to get started. +You can also give feedback [here](https://feedbackflux.vercel.app/brandonshen123@gmail.com/b/SearchVision) ## License diff --git a/dataset/data.yaml b/dataset/data.yaml new file mode 100644 index 0000000..4ff8642 --- /dev/null +++ b/dataset/data.yaml @@ -0,0 +1,5 @@ +path: C:\Users\Brandon Shen\Documents\SearchVision\dataset +train: C:\Users\Brandon Shen\Documents\SearchVision\dataset\train\images +val: C:\Users\Brandon Shen\Documents\SearchVision\dataset\train\images +names: + 0: basketball diff --git a/dataset/train/labels.cache b/dataset/train/labels.cache new file mode 100644 index 0000000..f835e11 Binary files /dev/null and b/dataset/train/labels.cache differ diff --git a/requirements.txt b/requirements.txt index 2be2fb1..8cbd9f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,3 +4,9 @@ requests beautifulsoup4 ultralytics python-multipart +torch +torchvision +numpy +scikit-learn +pillow +python-dotenv diff --git a/runs/detect/train/args.yaml b/runs/detect/train/args.yaml new file mode 100644 index 0000000..315f5b0 --- /dev/null +++ b/runs/detect/train/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train diff --git a/runs/detect/train10/args.yaml b/runs/detect/train10/args.yaml new file mode 100644 index 0000000..e46c174 --- /dev/null +++ b/runs/detect/train10/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train10 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train10 diff --git a/runs/detect/train11/args.yaml b/runs/detect/train11/args.yaml new file mode 100644 index 0000000..51a4b2a --- /dev/null +++ b/runs/detect/train11/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train11 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train11 diff --git a/runs/detect/train12/args.yaml b/runs/detect/train12/args.yaml new file mode 100644 index 0000000..7bfc360 --- /dev/null +++ b/runs/detect/train12/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train12 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train12 diff --git a/runs/detect/train13/args.yaml b/runs/detect/train13/args.yaml new file mode 100644 index 0000000..6322fa5 --- /dev/null +++ b/runs/detect/train13/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train13 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train13 diff --git a/runs/detect/train14/args.yaml b/runs/detect/train14/args.yaml new file mode 100644 index 0000000..9c1277a --- /dev/null +++ b/runs/detect/train14/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train14 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train14 diff --git a/runs/detect/train15/args.yaml b/runs/detect/train15/args.yaml new file mode 100644 index 0000000..0f2ddb5 --- /dev/null +++ b/runs/detect/train15/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train15 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train15 diff --git a/runs/detect/train16/args.yaml b/runs/detect/train16/args.yaml new file mode 100644 index 0000000..de81f9f --- /dev/null +++ b/runs/detect/train16/args.yaml @@ -0,0 +1,107 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset\data.yaml +epochs: 25 +time: null +patience: 10 +batch: 8 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: cpu +workers: 8 +project: null +name: train16 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: true +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +copy_paste_mode: flip +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: C:\Users\Brandon Shen\Documents\SearchVision\runs\detect\train16 diff --git a/runs/detect/train17/F1_curve.png b/runs/detect/train17/F1_curve.png new file mode 100644 index 0000000..5158e5e Binary files /dev/null and b/runs/detect/train17/F1_curve.png differ diff --git a/runs/detect/train17/PR_curve.png b/runs/detect/train17/PR_curve.png new file mode 100644 index 0000000..33f9935 Binary files /dev/null and b/runs/detect/train17/PR_curve.png differ diff --git a/runs/detect/train17/P_curve.png b/runs/detect/train17/P_curve.png new file mode 100644 index 0000000..525f554 Binary files /dev/null and b/runs/detect/train17/P_curve.png differ diff --git a/runs/detect/train17/R_curve.png b/runs/detect/train17/R_curve.png new file mode 100644 index 0000000..359d844 Binary files /dev/null and b/runs/detect/train17/R_curve.png differ diff --git a/runs/detect/train17/args.yaml b/runs/detect/train17/args.yaml new file mode 100644 index 0000000..55ff50a --- /dev/null +++ b/runs/detect/train17/args.yaml @@ -0,0 +1,107 @@ +task: detect +mode: train +model: yolov8n.pt +data: C:\Users\Brandon Shen\Documents\SearchVision\dataset\data.yaml +epochs: 25 +time: null +patience: 10 +batch: 8 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: cpu +workers: 8 +project: null +name: train17 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: true +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +copy_paste_mode: flip +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: C:\Users\Brandon Shen\Documents\SearchVision\runs\detect\train17 diff --git a/runs/detect/train17/confusion_matrix.png b/runs/detect/train17/confusion_matrix.png new file mode 100644 index 0000000..6ff56da Binary files /dev/null and b/runs/detect/train17/confusion_matrix.png differ diff --git a/runs/detect/train17/confusion_matrix_normalized.png b/runs/detect/train17/confusion_matrix_normalized.png new file mode 100644 index 0000000..04e394f Binary files /dev/null and b/runs/detect/train17/confusion_matrix_normalized.png differ diff --git a/runs/detect/train17/events.out.tfevents.1740701719.PW4638167770234.55244.0 b/runs/detect/train17/events.out.tfevents.1740701719.PW4638167770234.55244.0 new file mode 100644 index 0000000..9a5bbf6 Binary files /dev/null and b/runs/detect/train17/events.out.tfevents.1740701719.PW4638167770234.55244.0 differ diff --git a/runs/detect/train17/labels.jpg b/runs/detect/train17/labels.jpg new file mode 100644 index 0000000..5baaba5 Binary files /dev/null and b/runs/detect/train17/labels.jpg differ diff --git a/runs/detect/train17/labels_correlogram.jpg b/runs/detect/train17/labels_correlogram.jpg new file mode 100644 index 0000000..7351913 Binary files /dev/null and b/runs/detect/train17/labels_correlogram.jpg differ diff --git a/runs/detect/train17/results.csv b/runs/detect/train17/results.csv new file mode 100644 index 0000000..e4b1c96 --- /dev/null +++ b/runs/detect/train17/results.csv @@ -0,0 +1,26 @@ +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,21.0361,0.91108,2.80163,1.17384,0.00856,0.9625,0.34137,0.24818,0.39739,2.98326,0.90614,6e-05,6e-05,6e-05 +2,33.0195,0.98657,2.64668,1.13301,0.00867,0.975,0.4323,0.35792,0.46403,2.96352,0.91283,0.000134456,0.000134456,0.000134456 +3,43.9278,0.84994,2.10175,1.12605,0.00867,0.975,0.4622,0.37828,0.53374,2.91079,0.92489,0.000202576,0.000202576,0.000202576 +4,55.7088,0.81153,1.78668,1.07674,0.00878,0.9875,0.51515,0.40305,0.61849,2.79785,0.95287,0.00026436,0.00026436,0.00026436 +5,67.7567,0.90498,1.49133,1.07601,0.94146,0.2011,0.5381,0.396,0.70973,2.6416,0.97848,0.000319808,0.000319808,0.000319808 +6,80.1714,0.936,1.94005,1.25179,0.95326,0.25506,0.55077,0.43206,0.69786,2.55737,0.96863,0.00036892,0.00036892,0.00036892 +7,91.0975,0.86754,1.52,1.12672,0.96576,0.3526,0.58323,0.48808,0.66286,2.46892,0.97026,0.000411696,0.000411696,0.000411696 +8,101.657,0.80064,1.6376,1.12076,0.96167,0.31364,0.57858,0.47984,0.66931,2.4826,0.97193,0.000448136,0.000448136,0.000448136 +9,112.643,0.63558,1.39311,1.05431,1,0.25529,0.57879,0.47119,0.68391,2.58967,0.97364,0.00047824,0.00047824,0.00047824 +10,123.155,0.78626,1.54893,1.13025,1,0.21903,0.55938,0.45304,0.69666,2.63499,0.97718,0.000502008,0.000502008,0.000502008 +11,133.726,0.7854,1.34338,1.08913,1,0.36744,0.56225,0.47962,0.70092,2.51946,0.9834,0.00051944,0.00051944,0.00051944 +12,144.197,0.79021,1.4295,1.09774,0.92005,0.4316,0.54507,0.46676,0.67422,2.34246,0.99195,0.000530536,0.000530536,0.000530536 +13,154.671,0.72066,1.33911,1.04883,0.79628,0.43977,0.56778,0.47914,0.65884,2.23407,0.98003,0.000535296,0.000535296,0.000535296 +14,165.229,0.69716,1.22407,1.04598,0.86489,0.56014,0.68678,0.6031,0.64374,2.10599,0.97019,0.00053372,0.00053372,0.00053372 +15,176.004,0.84211,1.1759,1.03366,0.84858,0.63049,0.79059,0.69692,0.62518,1.94564,0.99782,0.000525808,0.000525808,0.000525808 +16,186.86,0.5805,1.83191,0.97853,0.84858,0.63049,0.79059,0.69692,0.62518,1.94564,0.99782,0.00051156,0.00051156,0.00051156 +17,197.522,0.69049,1.67263,0.98821,0.89012,0.675,0.8282,0.71474,0.63029,1.88828,1.00195,0.000490976,0.000490976,0.000490976 +18,210.531,0.62329,1.87898,0.98679,0.88448,0.675,0.83214,0.7142,0.65848,1.86514,1.02756,0.000464056,0.000464056,0.000464056 +19,221.325,0.65359,1.47793,0.95454,0.88448,0.675,0.83214,0.7142,0.65848,1.86514,1.02756,0.0004308,0.0004308,0.0004308 +20,231.667,0.65471,1.68673,1.0228,0.96476,0.68446,0.82951,0.70684,0.66719,1.86883,1.04404,0.000391208,0.000391208,0.000391208 +21,242.31,0.644,1.74126,1.06733,0.9188,0.70729,0.84282,0.72777,0.65072,1.83517,1.00727,0.00034528,0.00034528,0.00034528 +22,252.655,0.60214,1.57435,0.9613,0.9188,0.70729,0.84282,0.72777,0.65072,1.83517,1.00727,0.000293016,0.000293016,0.000293016 +23,263.138,0.69024,1.60948,1.02949,0.908,0.74026,0.87572,0.75413,0.62707,1.7348,0.97154,0.000234416,0.000234416,0.000234416 +24,273.372,0.5577,1.43103,0.922,0.908,0.74026,0.87572,0.75413,0.62707,1.7348,0.97154,0.00016948,0.00016948,0.00016948 +25,284.072,0.79471,1.6108,1.10699,0.91309,0.78797,0.88191,0.75918,0.61545,1.61585,0.94993,9.8208e-05,9.8208e-05,9.8208e-05 diff --git a/runs/detect/train17/results.png b/runs/detect/train17/results.png new file mode 100644 index 0000000..3e885f3 Binary files /dev/null and b/runs/detect/train17/results.png differ diff --git a/runs/detect/train17/train_batch0.jpg b/runs/detect/train17/train_batch0.jpg new file mode 100644 index 0000000..48009b5 Binary files /dev/null and b/runs/detect/train17/train_batch0.jpg differ diff --git a/runs/detect/train17/train_batch1.jpg b/runs/detect/train17/train_batch1.jpg new file mode 100644 index 0000000..990b246 Binary files /dev/null and b/runs/detect/train17/train_batch1.jpg differ diff --git a/runs/detect/train17/train_batch2.jpg b/runs/detect/train17/train_batch2.jpg new file mode 100644 index 0000000..b354a9d Binary files /dev/null and b/runs/detect/train17/train_batch2.jpg differ diff --git a/runs/detect/train17/train_batch60.jpg b/runs/detect/train17/train_batch60.jpg new file mode 100644 index 0000000..1dea173 Binary files /dev/null and b/runs/detect/train17/train_batch60.jpg differ diff --git a/runs/detect/train17/train_batch61.jpg b/runs/detect/train17/train_batch61.jpg new file mode 100644 index 0000000..608396a Binary files /dev/null and b/runs/detect/train17/train_batch61.jpg differ diff --git a/runs/detect/train17/train_batch62.jpg b/runs/detect/train17/train_batch62.jpg new file mode 100644 index 0000000..8b35e40 Binary files /dev/null and b/runs/detect/train17/train_batch62.jpg differ diff --git a/runs/detect/train17/val_batch0_labels.jpg b/runs/detect/train17/val_batch0_labels.jpg new file mode 100644 index 0000000..524c0b5 Binary files /dev/null and b/runs/detect/train17/val_batch0_labels.jpg differ diff --git a/runs/detect/train17/val_batch0_pred.jpg b/runs/detect/train17/val_batch0_pred.jpg new file mode 100644 index 0000000..f870c41 Binary files /dev/null and b/runs/detect/train17/val_batch0_pred.jpg differ diff --git a/runs/detect/train17/val_batch1_labels.jpg b/runs/detect/train17/val_batch1_labels.jpg new file mode 100644 index 0000000..d6ccc49 Binary files /dev/null and b/runs/detect/train17/val_batch1_labels.jpg differ diff --git a/runs/detect/train17/val_batch1_pred.jpg b/runs/detect/train17/val_batch1_pred.jpg new file mode 100644 index 0000000..19da4b7 Binary files /dev/null and b/runs/detect/train17/val_batch1_pred.jpg differ diff --git a/runs/detect/train17/weights/best.pt b/runs/detect/train17/weights/best.pt new file mode 100644 index 0000000..db68787 Binary files /dev/null and b/runs/detect/train17/weights/best.pt differ diff --git a/runs/detect/train17/weights/last.pt b/runs/detect/train17/weights/last.pt new file mode 100644 index 0000000..b8938b7 Binary files /dev/null and b/runs/detect/train17/weights/last.pt differ diff --git a/runs/detect/train2/args.yaml b/runs/detect/train2/args.yaml new file mode 100644 index 0000000..9716e45 --- /dev/null +++ b/runs/detect/train2/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train2 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train2 diff --git a/runs/detect/train3/args.yaml b/runs/detect/train3/args.yaml new file mode 100644 index 0000000..fd7e27e --- /dev/null +++ b/runs/detect/train3/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train3 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train3 diff --git a/runs/detect/train4/args.yaml b/runs/detect/train4/args.yaml new file mode 100644 index 0000000..1871847 --- /dev/null +++ b/runs/detect/train4/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train4 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train4 diff --git a/runs/detect/train5/args.yaml b/runs/detect/train5/args.yaml new file mode 100644 index 0000000..6278269 --- /dev/null +++ b/runs/detect/train5/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train5 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train5 diff --git a/runs/detect/train6/args.yaml b/runs/detect/train6/args.yaml new file mode 100644 index 0000000..e19c16b --- /dev/null +++ b/runs/detect/train6/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train6 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train6 diff --git a/runs/detect/train7/args.yaml b/runs/detect/train7/args.yaml new file mode 100644 index 0000000..bec1959 --- /dev/null +++ b/runs/detect/train7/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train7 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train7 diff --git a/runs/detect/train8/args.yaml b/runs/detect/train8/args.yaml new file mode 100644 index 0000000..032cb2b --- /dev/null +++ b/runs/detect/train8/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train8 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train8 diff --git a/runs/detect/train9/args.yaml b/runs/detect/train9/args.yaml new file mode 100644 index 0000000..00bb6a7 --- /dev/null +++ b/runs/detect/train9/args.yaml @@ -0,0 +1,106 @@ +task: detect +mode: train +model: yolov8n.pt +data: dataset/data.yaml +epochs: 50 +time: null +patience: 100 +batch: 16 +imgsz: 640 +save: true +save_period: -1 +cache: false +device: null +workers: 8 +project: null +name: train9 +exist_ok: false +pretrained: 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: false +overlap_mask: true +mask_ratio: 4 +dropout: 0.0 +val: true +split: val +save_json: false +save_hybrid: false +conf: null +iou: 0.7 +max_det: 300 +half: false +dnn: false +plots: true +source: null +vid_stride: 1 +stream_buffer: false +visualize: false +augment: false +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 +int8: false +dynamic: false +simplify: false +opset: null +workspace: 4 +nms: false +lr0: 0.01 +lrf: 0.01 +momentum: 0.937 +weight_decay: 0.0005 +warmup_epochs: 3.0 +warmup_momentum: 0.8 +warmup_bias_lr: 0.1 +box: 7.5 +cls: 0.5 +dfl: 1.5 +pose: 12.0 +kobj: 1.0 +label_smoothing: 0.0 +nbs: 64 +hsv_h: 0.015 +hsv_s: 0.7 +hsv_v: 0.4 +degrees: 0.0 +translate: 0.1 +scale: 0.5 +shear: 0.0 +perspective: 0.0 +flipud: 0.0 +fliplr: 0.5 +bgr: 0.0 +mosaic: 1.0 +mixup: 0.0 +copy_paste: 0.0 +auto_augment: randaugment +erasing: 0.4 +crop_fraction: 1.0 +cfg: null +tracker: botsort.yaml +save_dir: runs\detect\train9 diff --git a/src/auto_annotate_images.py b/src/auto_annotate_images.py new file mode 100644 index 0000000..74bb769 --- /dev/null +++ b/src/auto_annotate_images.py @@ -0,0 +1,83 @@ +from ultralytics import YOLO +import os +from PIL import Image +import logging + +logger = logging.getLogger(__name__) + + +def auto_annotate_images(image_folder, labels_folder): + """ + Auto-annotate images using YOLOv8 and save annotations in YOLO format. + + Args: + image_folder: Directory containing images + labels_folder: Directory where annotation files will be saved + """ + # Load the pre-trained YOLOv8 model + model = YOLO('yolov8n.pt') + + os.makedirs(labels_folder, exist_ok=True) + + # Track statistics + processed_count = 0 + annotated_count = 0 + error_count = 0 + + # Loop through images in the specified folder + for image_file in os.listdir(image_folder): + if image_file.endswith(('.jpg', '.jpeg', '.png')): + image_path = os.path.join(image_folder, image_file) + + # Check if the image can be opened and processed + try: + # Get image dimensions + with Image.open(image_path) as img: + img_width, img_height = img.size + + # Run detection + results = model(image_path) + processed_count += 1 + + # Create annotation filename + label_filename = os.path.splitext(image_file)[0] + ".txt" + label_path = os.path.join(labels_folder, label_filename) + + # Process the results + for result in results: + if result.boxes is not None and len(result.boxes) > 0: + # Extract bounding boxes + boxes = result.boxes.xyxy.cpu().numpy() + + with open(label_path, 'w') as f: + for box in boxes: + if len(box) >= 4: + x_min, y_min, x_max, y_max = box[:4] + + # Calculate YOLO format (normalized) + x_center = ( + (x_min + x_max) / 2) / img_width + y_center = ( + (y_min + y_max) / 2) / img_height + width = (x_max - x_min) / img_width + height = (y_max - y_min) / img_height + + # Class 0 for all objects (single class) + f.write( + f"0 {x_center:.6f} {y_center:.6f} {width:.6f} {height:.6f}\n") + annotated_count += 1 + + logger.info(f"Saved YOLO annotations for {image_file}") + else: + logger.warning(f"No objects detected in {image_file}") + + except Exception as e: + logger.error(f"Error processing image {image_path}: {e}") + error_count += 1 + continue + + logger.info( + f"Auto-annotation complete: processed {processed_count} images, " + f"created {annotated_count} annotations, {error_count} errors") + + return processed_count, annotated_count, error_count diff --git a/src/create_data_yaml.py b/src/create_data_yaml.py new file mode 100644 index 0000000..1ce53e2 --- /dev/null +++ b/src/create_data_yaml.py @@ -0,0 +1,39 @@ +import os +import yaml + + +def create_data_yaml(annotations_path, object_name="object"): + """ + Create a YAML configuration file for YOLOv8 training. + + Args: + annotations_path: Path to annotations (used for determining dataset path) + object_name: Name of the object class + + Returns: + Path to the created YAML file + """ + # Use absolute paths + base_dir = os.path.dirname( + os.path.dirname( + os.path.abspath(annotations_path))) + train_images_path = os.path.join(base_dir, "train", "images") + train_labels_path = os.path.join(base_dir, "train", "labels") + + # Dataset structure expected by YOLOv8 with absolute paths + data = { + 'path': base_dir, # Absolute base path + 'train': train_images_path, # Absolute train images path + 'val': train_images_path, # Using same images for validation + 'names': { + 0: object_name # Single class detection + } + } + + # Create the YAML file + yaml_path = os.path.join(base_dir, 'data.yaml') + with open(yaml_path, 'w') as f: + yaml.dump(data, f, sort_keys=False, default_flow_style=False) + + print(f"Created data.yaml at {yaml_path}") + return yaml_path diff --git a/src/download_images.py b/src/download_images.py new file mode 100644 index 0000000..398dc20 --- /dev/null +++ b/src/download_images.py @@ -0,0 +1,44 @@ +# src/download_images.py + +import requests +import os + + +def download_images(image_urls, download_path="dataset/train/images"): + """ + Downloads images from a list of URLs and saves them to the specified directory. + + :param image_urls: List of image URLs to download. + :param download_path: Directory to save downloaded images. + :return: List of file paths for successfully downloaded images. + """ + print("Starting image download...") # Debugging statement + + # Ensure the download directory exists + if not os.path.exists(download_path): + os.makedirs(download_path) + + # List to hold paths of successfully downloaded images + downloaded_paths = [] + + # Iterate over the image URLs and download each image + for idx, url in enumerate(image_urls): + print(f"Attempting to download: {url}") # Debugging statement + try: + response = requests.get(url) + if response.status_code == 200: + file_path = os.path.join(download_path, f"image_{idx}.jpg") + with open(file_path, "wb") as f: + f.write(response.content) + print(f"Downloaded: {file_path}") + downloaded_paths.append(file_path) # Add path to list + else: + print(f"Failed to download {url}") + except Exception as e: + print(f"Error downloading {url}: {e}") + + # Check if any images were downloaded + if not downloaded_paths: + print("No images were downloaded.") + + return downloaded_paths diff --git a/src/main.py b/src/main.py index 381d431..32c3449 100644 --- a/src/main.py +++ b/src/main.py @@ -1,95 +1,301 @@ import os -from fastapi import FastAPI, Form, HTTPException -from fastapi.responses import HTMLResponse +import json +import asyncio +from pathlib import Path +from fastapi import FastAPI, Form, HTTPException, Query, Request +from fastapi.responses import HTMLResponse, JSONResponse +from fastapi.templating import Jinja2Templates from fastapi.staticfiles import StaticFiles import logging +from dotenv import load_dotenv +from src.auto_annotate_images import auto_annotate_images +from src.download_images import download_images from src.search_images import search_images +from src.search_most_dissimilar_images import select_most_dissimilar_images from src.train_model import train_model from src.scrape_similar import scrape_similar_images +from PIL import Image +from src.create_data_yaml import create_data_yaml +import shutil +from src.utils.annotation_converter import convert_to_yolo_format, ensure_directory + +load_dotenv() -# Initialize the FastAPI app app = FastAPI() -# Set up logging -logging.basicConfig(level=logging.INFO) +templates = Jinja2Templates(directory=Path(__file__).parent / "templates") + +log_file_path = os.path.join(os.getcwd(), 'app_logs.txt') +logging.basicConfig( + level=logging.INFO, + format='%(asctime)s - %(levelname)s - %(message)s', + handlers=[ + logging.FileHandler(log_file_path), + logging.StreamHandler() + ] +) logger = logging.getLogger(__name__) -# Serve static files (like images) from the "static" directory -try: - static_path = os.path.join(os.path.dirname(__file__), "static") - if not os.path.exists(static_path): - raise FileNotFoundError( - f"Static directory '{static_path}' does not exist.") - app.mount("/static", StaticFiles(directory=static_path), name="static") -except Exception as e: - logger.error(f"Error setting up static files: {e}") +images_path = "dataset/train/images" +labels_path = "dataset/train/labels" +download_path = "dataset/train/images" -# Route to handle the main form +os.makedirs(download_path, exist_ok=True) +app.mount("/images", StaticFiles(directory=download_path), name="images") +training_status = { + "step": 0, + "status": "Idle", + "detail": "", + "completed": False, + "success": False, + "model_path": "", + "error": "", + "query": "" +} + + +def clear_directory(path): + if os.path.exists(path): + shutil.rmtree(path) + os.makedirs(path) -@app.get("/", response_class=HTMLResponse) -async def index(): - try: - html_content = """ - -
- - - - """ - return html_content - except Exception as e: - logger.error(f"Error generating the index page: {e}") - raise HTTPException(status_code=500, detail="Internal Server Error") -# Route to handle the search and display images +def reset_training_status(query): + global training_status + training_status = { + "step": 0, + "status": "Starting", + "detail": "Initializing...", + "completed": False, + "success": False, + "model_path": "", + "error": "", + "query": query + } + + +@app.get("/", response_class=HTMLResponse) +async def index(request: Request): + clear_directory(images_path) + clear_directory(labels_path) + return templates.TemplateResponse("search.html", {"request": request}) @app.post("/search", response_class=HTMLResponse) -async def search(query: str = Form(...)): +async def search(request: Request, query: str = Form(...)): try: - api_key = "YOUR_API_KEY" - search_engine_id = "YOUR_SEARCH_ENGINE_ID" + api_key = os.getenv("GOOGLE_API_KEY") + search_engine_id = os.getenv("SEARCH_ENGINE_ID") + + if not api_key or not search_engine_id: + return templates.TemplateResponse("search.html", { + "request": request, + "error": "API keys not configured. Please set GOOGLE_API_KEY and SEARCH_ENGINE_ID in .env" + }) + images = search_images(query, api_key, search_engine_id) if not images: - return HTMLResponse("Draw bounding boxes around the object you want to detect
+Train your own object detection model in minutes
+Your model is ready to detect: {{ query }}
+Enter any object to train a custom detection model
+ + +Find relevant images using Google Custom Search
+Draw bounding boxes on selected images
+Automatically scrape more data and train YOLOv8
+Choose at least 3 images that clearly show the object you want to detect
+Detecting: {{ query }}
+ +