{"id":20600973,"url":"https://github.com/colddsam/modeyolo","last_synced_at":"2026-05-21T05:02:55.579Z","repository":{"id":226762436,"uuid":"769585310","full_name":"colddsam/ModeYOLO","owner":"colddsam","description":"ModeYOLO: Elevate image processing with this Python package. Seamlessly perform color space transformations, simplify dataset modification for deep learning, and leverage OpenCV and NumPy. Ideal for YOLO projects, computer vision tasks, and efficient machine learning workflows.","archived":false,"fork":false,"pushed_at":"2024-03-29T19:10:15.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-06T16:18:27.767Z","etag":null,"topics":["dataset","dataset-generation","open-source","opencv","python","pythonpackage","ultralytics","yolo"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/modeyolo/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/colddsam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-03-09T13:50:52.000Z","updated_at":"2024-03-09T19:04:54.000Z","dependencies_parsed_at":"2024-03-13T21:30:34.802Z","dependency_job_id":"1ea0d79c-af09-4acf-bde8-6b1095a56262","html_url":"https://github.com/colddsam/ModeYOLO","commit_stats":null,"previous_names":["colddsam/modeyolo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colddsam%2FModeYOLO","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colddsam%2FModeYOLO/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colddsam%2FModeYOLO/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/colddsam%2FModeYOLO/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/colddsam","download_url":"https://codeload.github.com/colddsam/ModeYOLO/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242241246,"owners_count":20095339,"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","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":["dataset","dataset-generation","open-source","opencv","python","pythonpackage","ultralytics","yolo"],"created_at":"2024-11-16T09:07:42.480Z","updated_at":"2026-05-21T05:02:50.530Z","avatar_url":"https://github.com/colddsam.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ModeYOLO Python Package\n\n## Introduction\nModeYOLO is a versatile Python package designed for efficient color space transformations, dataset modification, and YOLO model training. It seamlessly integrates into your workflow, providing solutions for diverse machine learning applications in computer vision.\n\n\n## Dependencies\nModeYOLO depends on the following libraries:\n- Ultralytics (`ultralytics`)\n- PyTorch (`torch`)\n- os (`os`)\n- opencv-python (`cv2`)\n\n### Folder Structure\nBefore using the package, ensure that your source dataset follows the following folder structure:\n\n```plaintext\ndataset/\n|-- train/\n|   |-- images/\n|   |-- labels/\n|-- test/\n|   |-- images/\n|   |-- labels/\n|-- val/\n|   |-- images/\n|   |-- labels/\n|-- data.yaml\n```\n\n## ColorOperation Module (`ColorOperation.py`)\n\n### Class: `colorcng`\n\n#### Color Spaces: \nCurrently we accepting this `['RGB', 'BGR', 'GRAY', 'CrCb', 'LAB', 'HSV']` Color Spaces. Each element in the list corresponds to a specific color space. Here's an explanation of each color space:\n\n1. **RGB (Red, Green, Blue):** The standard color model used in most digital cameras and displays, where each pixel is represented by three values indicating the intensity of red, green, and blue.\n\n2. **BGR (Blue, Green, Red):** Similar to RGB but with the order of color channels reversed. OpenCV, a popular computer vision library, uses BGR as its default color order.\n\n3. **GRAY (Grayscale):** A single-channel color space where each pixel is represented by a single intensity value, typically ranging from black to white.\n\n4. **CrCb:** A component of the YCbCr color space often used in image and video compression. It separates chrominance (color information) from luminance (brightness information).\n\n5. **LAB:** The LAB color space represents colors independently of device-specific characteristics. It consists of three components: L* (luminance), a* (green to red), and b* (blue to yellow).\n\n6. **HSV (Hue, Saturation, Value):** A color space that separates color information into three components: hue (the type of color), saturation (the intensity or vividness of the color), and value (brightness). \n\n#### Constructor\n```python\ndef __init__(self, path: str, mode: str = 'all') -\u003e None:\n    \"\"\"\n    Initializes the colorcng object.\n\n    Parameters:\n    - path: str, path to the target directory.\n    - mode: str, mode of operation ('all', 'rgb', 'bgr', 'gray', 'hsv', 'crcb', 'lab').\n    \"\"\"\n```\n\n#### Methods\n1. `cng_rgb`\n    ```python\n    def cng_rgb(self, opt: str, img: np.ndarray, idx: int | str = 0) -\u003e None:\n        \"\"\"\n        Converts the image to RGB color space.\n\n        Parameters:\n        - opt: str, operation type ('train', 'test', 'val').\n        - img: np.ndarray, input image.\n        - idx: int | str, index for the output file name.\n        \"\"\"\n    ```\n\n2. `cng_bgr`\n    ```python\n    def cng_bgr(self, opt: str, img: np.ndarray, idx: int | str = 0) -\u003e None:\n        \"\"\"\n        Saves the image in BGR color space.\n\n        Parameters:\n        - opt: str, operation type ('train', 'test', 'val').\n        - img: np.ndarray, input image.\n        - idx: int | str, index for the output file name.\n        \"\"\"\n    ```\n\n3. `cng_gray`\n    ```python\n    def cng_gray(self, opt: str, img: np.ndarray, idx: int | str = 0) -\u003e None:\n        \"\"\"\n        Converts the image to grayscale.\n\n        Parameters:\n        - opt: str, operation type ('train', 'test', 'val').\n        - img: np.ndarray, input image.\n        - idx: int | str, index for the output file name.\n        \"\"\"\n    ```\n\n4. `cng_hsv`\n    ```python\n    def cng_hsv(self, opt: str, img: np.ndarray, idx: int | str = 0) -\u003e None:\n        \"\"\"\n        Converts the image to HSV color space.\n\n        Parameters:\n        - opt: str, operation type ('train', 'test', 'val').\n        - img: np.ndarray, input image.\n        - idx: int | str, index for the output file name.\n        \"\"\"\n    ```\n\n5. `cng_crcb`\n    ```python\n    def cng_crcb(self, opt: str, img: np.ndarray, idx: int | str = 0) -\u003e None:\n        \"\"\"\n        Converts the image to YCrCb color space.\n\n        Parameters:\n        - opt: str, operation type ('train', 'test', 'val').\n        - img: np.ndarray, input image.\n        - idx: int | str, index for the output file name.\n        \"\"\"\n    ```\n\n6. `cng_lab`\n    ```python\n    def cng_lab(self, opt: str, img: np.ndarray, idx: int | str = 0) -\u003e None:\n        \"\"\"\n        Converts the image to LAB color space.\n\n        Parameters:\n        - opt: str, operation type ('train', 'test', 'val').\n        - img: np.ndarray, input image.\n        - idx: int | str, index for the output file name.\n        \"\"\"\n    ```\n\n7. `execute`\n    ```python\n    def execute(self, opt: str, file: str, idx: int | str = 0) -\u003e None:\n        \"\"\"\n        Executes the specified color space transformation.\n\n        Parameters:\n        - opt: str, operation type ('train', 'test', 'val').\n        - file: str, path to the input image.\n        - idx: int | str, index for the output file name.\n        \"\"\"\n    ```\n\n## Dataset Modifier Module (`DatasetModifier.py`)\n\n### Class: `InitModifier`\n\n#### Constructor\n```python\ndef __init__(self, target_directory: str = 'modified_dataset', src_directory: str = 'dataset', mode: str = 'all') -\u003e None:\n    \"\"\"\n    Initializes the InitModifier object.\n\n    Parameters:\n    - target_directory: str, path to the target directory.\n    - src_directory: str, path to the source dataset directory.\n    - mode: str, mode of operation ('all', 'rgb', 'bgr', 'gray', 'hsv', 'crcb', 'lab').\n    \"\"\"\n```\n\n#### Methods\n1. `start_train`\n    ```python\n    def start_train(self) -\u003e None:\n        \"\"\"\n        Creates the modified training dataset.\n        \"\"\"\n    ```\n\n2. `start_test`\n    ```python\n    def start_test(self) -\u003e None:\n        \"\"\"\n        Creates the modified testing dataset.\n        \"\"\"\n    ```\n\n3. `start_val`\n    ```python\n    def start_val(self) -\u003e None:\n        \"\"\"\n        Creates the modified validation dataset.\n        \"\"\"\n    ```\n\n4. `reform_dataset`\n    ```python\n    def reform_dataset(self) -\u003e None:\n        \"\"\"\n        Reformats the entire dataset.\n        \"\"\"\n    ```\n\n### Example Usage\n\n```python\n# Import the InitModifier class\nfrom ModeYOLO.DatasetModifier import InitModifier\n\n# Create an InitModifier object\ninit_op = InitModifier(target_directory='modified_dataset', src_directory='dataset', mode='all')\n\n# Create the modified dataset\ninit_op.reform_dataset()\n```\n\n\n## ModelTrain Module (`ModelTrain.py`)\n### Class: `trainYOLO`\nThis submodule facilitates YOLO model training with various pre-trained models. Users can choose from a selection of YOLO models, specify training parameters, and seamlessly integrate it into their workflows.\n\n\n### Pre-trained Models\nThe `trainYOLO` submodule supports training with various pre-trained YOLO models. Choose a model by entering the corresponding index when prompted. Here are the available models:\n\n1. `yolov3u.pt`: YOLOv3 with upsampling\n2. `yolov5nu.pt`: YOLOv5 with narrow channels\n3. `yolov5su.pt`: YOLOv5 with small model\n4. `yolov5mu.pt`: YOLOv5 with medium model\n5. `yolov5lu.pt`: YOLOv5 with large model\n6. `yolov5xu.pt`: YOLOv5 with extra-large model\n7. `yolov5n6u.pt`: YOLOv5 with narrow channels and 6x size\n8. `yolov5s6u.pt`: YOLOv5 with small model and 6x size\n9. `yolov5m6u.pt`: YOLOv5 with medium model and 6x size\n10. `yolov5l6u.pt`: YOLOv5 with large model and 6x size\n11. `yolov5x6u.pt`: YOLOv5 with extra-large model and 6x size\n12. `yolov6n.pt`: YOLOv6 with narrow channels\n13. `yolov6s.pt`: YOLOv6 with small model\n14. `yolov6m.pt`: YOLOv6 with medium model\n15. `yolov6l.pt`: YOLOv6 with large model\n16. `yolov6l6.pt`: YOLOv6 with large model and 6x size\n17. `yolov8n.pt`: YOLOv8 with narrow channels\n18. `yolov8s.pt`: YOLOv8 with small model\n19. `yolov8m.pt`: YOLOv8 with medium model\n20. `yolov8l.pt`: YOLOv8 with large model\n21. `yolov8x.pt`: YOLOv8 with extra-large model\n22. `yolov9s.pt`: YOLOv9 with small model\n23. `yolov9m.pt`: YOLOv9 with medium model\n24. `yolov9c.pt`: YOLOv9 with complex model\n25. `yolov9e.pt`: YOLOv9 with extra-large model\n\nChoose a model based on your specific requirements and follow the on-screen instructions during training for optimal results.\n\n\n### Example Usage\n```python\n# Import the trainYOLO class\nfrom ModeYOLO.ModelTrain import trainYOLO\n\n# Create a trainYOLO object\nyolo_trainer = trainYOLO(target_directory='modified_dataset', src_directory='dataset', mode='all', data_path='./modified_dataset/data.yaml', epochs=1, imgsz=224)\n\n# Train the YOLO model\nyolo_trainer.train()\n\n# Validate the trained model\nyolo_trainer.val()\n```\n\n**Note:** Follow the on-screen instructions to choose a YOLO model for training.\n\n## License\nThis project is licensed under the MIT License - see the [LICENSE]('https://github.com/colddsam/ModeYOLO/blob/main/LICENSE') file for details.\n\n## Acknowledgments\n- Mention any contributors or external libraries that inspired or helped with the development of ModeYOLO.\n\n- Feel free to adjust the content as needed and let me know if you have further requirements!\n\n- This example assumes that the source dataset is structured according to the specified folder structure. Adjust the paths and parameters accordingly based on your dataset structure.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolddsam%2Fmodeyolo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcolddsam%2Fmodeyolo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcolddsam%2Fmodeyolo/lists"}