{"id":24355692,"url":"https://github.com/bigmb/mb_yolo","last_synced_at":"2025-08-18T15:04:54.178Z","repository":{"id":271721676,"uuid":"800265263","full_name":"bigmb/mb_yolo","owner":"bigmb","description":"yolo models using ultralytics","archived":false,"fork":false,"pushed_at":"2025-01-16T15:56:58.000Z","size":1235,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T07:32:58.540Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigmb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-14T02:26:43.000Z","updated_at":"2025-01-16T15:56:59.000Z","dependencies_parsed_at":"2025-01-16T16:58:33.054Z","dependency_job_id":null,"html_url":"https://github.com/bigmb/mb_yolo","commit_stats":null,"previous_names":["bigmb/mb_yolo"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/bigmb/mb_yolo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_yolo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_yolo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_yolo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_yolo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigmb","download_url":"https://codeload.github.com/bigmb/mb_yolo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmb%2Fmb_yolo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271011769,"owners_count":24684402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-18T17:58:58.373Z","updated_at":"2025-08-18T15:04:54.152Z","avatar_url":"https://github.com/bigmb.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MB-YOLO\n\nMB-YOLO is a Python package that implements YOLO (You Only Look Once) object detection with a focus on weld defect detection. It supports multiple YOLO versions and includes integration with SAM2 (Segment Anything Model 2) for advanced segmentation capabilities.\n\n## Features\n\n- Support for multiple YOLO versions (YOLOv3, YOLOv5, YOLOv8, YOLO10, YOLO11)\n- Configurable model parameters (size, function, classes)\n- Integration with SAM2 for detailed segmentation\n- Easy-to-use training and inference pipeline\n- Flexible configuration system\n- Specialized for weld defect detection\n\n## Package Structure\n\nThe `mb_yolo` package consists of several key modules:\n\n### train.py\nMain training module that handles:\n- Configuration loading from YAML files\n- Model initialization\n- Training pipeline setup using Ultralytics\n- Automated result saving and logging\n\n```python\nfrom mb_yolo.train import train\ntrain(\"config.yaml\")  # Starts training with specified configuration\n```\n\n### models.py\nModel management module that provides:\n- Support for multiple YOLO versions (v3, v5, v8, v10, v11)\n- Model size configurations (n, s, m, l, x)\n- Multiple model functions:\n  - Detection (default)\n  - Segmentation\n  - Pose estimation\n  - Oriented bounding box (OBB)\n  - Classification\n- Automatic model creation and class number modification\n\n```python\nfrom mb_yolo.models import create_model\nmodel = create_model('yolov8', 'n', 'detection', num_classes=3)\n```\n\n### utils.py\nUtility functions for object detection operations:\n- IoU (Intersection over Union) calculation between bounding boxes\n- Non-Maximum Suppression (NMS) implementation for filtering overlapping detections\n- Bounding box format conversion (xywh to xyxy)\n\n```python\nfrom mb_yolo.utils import Utils\n# Calculate IoU between two boxes\niou = Utils.iou(box1, box2)\n# Convert box format\nxyxy = Utils.xywh2xyxy(boxes)\n# Apply NMS\nkept_indices = Utils.non_max_suppression(boxes, scores, iou_threshold=0.5)\n```\n\n## Installation\n\n```\npip install mb_yolo -U\n```\n\n```bash\n# Clone the repository\ngit clone https://github.com/bigmb/mb_yolo.git\n\n# Install the package\npip install -e .\n```\n\nRequirements:\n- Python \u003e= 3.8\n- mb_base\n- ultralytics\n\n## Usage\n\n### Training\n\n1. Prepare your data configuration in `model_configs/data.yaml`:\n```yaml\npath: /path/to/dataset\ntrain: train/images\nval: valid/images\ntest: test/images\n\nnames:\n  0: 'Bad Weld'\n  1: 'Good Weld'\n  2: 'Defect'\n```\n\n2. Configure training parameters in `config.yaml`:\n```yaml\nmodel: 'yolov8'\nmodel_size: 'n'\nmodel_function: 'detection'\nnum_classes: 3\nimg_size: 640\nbatch_size: 16\nepochs: 100\ndata_yaml: './model_configs/data.yaml'\nproject: 'yolo_project'\nname: 'run1'\ndevice: 'cpu'\nn_cpu: 4\n```\n\n3. Start training:\n```python\nfrom mb_yolo.train import train\ntrain(\"./config.yaml\")\n```\n\n### Inference\n\n```python\nfrom ultralytics import YOLO\n\n# Load model\nmodel = YOLO('./yolo_project/run1/weights/best.onnx')\n\n# Run inference\nresults = model('path/to/your/image.jpg')\n\n# Process results\nfor result in results:\n    print(result.boxes)  # Bounding boxes\n    print(result.names)  # Class names\n    result.show()  # Display results\n```\n\n### SAM2 Integration\n\nThe package includes integration with SAM2 for advanced segmentation:\n\n```python\nfrom mb_annotation.segsam2 import image_predictor\n\n# Initialize predictor\npredictor = image_predictor('./sam2_hiera_s.yaml',\n                          'path/to/sam2_checkpoint.pt')\n\n# Set image and predict\npredictor.set_image('path/to/image.jpg')\npredictor.predict_item(bbox=detection_box, gemini_bbox=False)\n```\n\n## Configuration\n\n### Model Configuration\n- Supported models: YOLOv3, YOLOv5, YOLOv8, YOLO10, YOLO11\n- Model sizes: n, s, m, l, x\n- Functions: detection, segmentation, pose, obb, classification (YOLOv8 and YOLO11 only)\n\n### Training Configuration\n- Batch size\n- Number of epochs\n- Image size\n- Device (CPU/GPU)\n- Number of workers\n- Project and run names for organizing results\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmb%2Fmb_yolo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigmb%2Fmb_yolo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmb%2Fmb_yolo/lists"}