Skip to content

Commit

Permalink
Stash current work.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 8, 2024
1 parent 24f72cc commit bcf5811
Show file tree
Hide file tree
Showing 14 changed files with 2,465 additions and 1,507 deletions.
15 changes: 14 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ Features

The following colour checker detection algorithms are implemented:

- Segmentation
- Segmentation
- Machine learning inference via `Ultralytics YOLOv8 <https://github.com/ultralytics/ultralytics>`__

- The model is published on `HuggingFace <https://huggingface.co/colour-science/colour-checker-detection-models>`__,
it was trained on a purposely constructed `dataset <https://huggingface.co/datasets/colour-science/colour-checker-detection-dataset>`__.
- Inference is performed by a script licensed under the terms of the
*GNU Affero General Public License v3.0* as it uses the
*Ultralytics YOLOv8* API which is incompatible with the
*BSD-3-Clause*.

Examples
^^^^^^^^
Expand Down Expand Up @@ -72,6 +80,11 @@ Primary Dependencies
- `opencv-python >= 4, < 5 <https://pypi.org/project/opencv-python>`__
- `scipy >= 1.8, < 2 <https://pypi.org/project/scipy>`__

Secondary Dependencies
~~~~~~~~~~~~~~~~~~~~~~

- `ultralytics >= 8, < 9 <https://pypi.org/project/ultralytics>`__

Pypi
~~~~

Expand Down
16 changes: 12 additions & 4 deletions colour_checker_detection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
import numpy as np

from .detection import (
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC,
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI,
SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC,
SETTINGS_SEGMENTATION_COLORCHECKER_NANO,
SETTINGS_SEGMENTATION_COLORCHECKER_SG,
colour_checkers_coordinates_segmentation,
detect_colour_checkers_inference,
detect_colour_checkers_segmentation,
extract_colour_checkers_segmentation,
inferencer_default,
segmenter_default,
)

__author__ = "Colour Developers"
Expand All @@ -35,11 +39,15 @@
__status__ = "Production"

__all__ = [
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC",
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI",
"SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC",
"SETTINGS_SEGMENTATION_COLORCHECKER_NANO",
"SETTINGS_SEGMENTATION_COLORCHECKER_SG",
"colour_checkers_coordinates_segmentation",
"extract_colour_checkers_segmentation",
"detect_colour_checkers_inference",
"detect_colour_checkers_segmentation",
"inferencer_default",
"segmenter_default",
]

ROOT_RESOURCES: str = os.path.join(os.path.dirname(__file__), "resources")
Expand Down
56 changes: 47 additions & 9 deletions colour_checker_detection/detection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,73 @@
from .common import (
FLOAT_DTYPE_DEFAULT,
DTYPE_INT_DEFAULT,
DTYPE_FLOAT_DEFAULT,
SETTINGS_DETECTION_COLORCHECKER_CLASSIC,
SETTINGS_DETECTION_COLORCHECKER_SG,
SETTINGS_CONTOUR_DETECTION_DEFAULT,
as_int32_array,
as_float32_array,
swatch_masks,
adjust_image,
crop_with_rectangle,
swatch_colours,
reformat_image,
transform_image,
detect_contours,
is_square,
contour_centroid,
scale_contour,
approximate_contour,
quadrilateralise_contours,
remove_stacked_contours,
DataDetectionColourChecker,
sample_colour_checker,
)
from .inference import (
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC,
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI,
inferencer_default,
detect_colour_checkers_inference,
)

from .segmentation import (
SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC,
SETTINGS_SEGMENTATION_COLORCHECKER_SG,
colour_checkers_coordinates_segmentation,
extract_colour_checkers_segmentation,
SETTINGS_SEGMENTATION_COLORCHECKER_NANO,
segmenter_default,
detect_colour_checkers_segmentation,
)

__all__ = [
"FLOAT_DTYPE_DEFAULT",
"DTYPE_INT_DEFAULT",
"DTYPE_FLOAT_DEFAULT",
"SETTINGS_DETECTION_COLORCHECKER_CLASSIC",
"SETTINGS_DETECTION_COLORCHECKER_SG",
"SETTINGS_CONTOUR_DETECTION_DEFAULT",
"as_int32_array",
"as_float32_array",
"swatch_masks",
"adjust_image",
"crop_with_rectangle",
"swatch_colours",
"reformat_image",
"transform_image",
"detect_contours",
"is_square",
"contour_centroid",
"scale_contour",
"approximate_contour",
"quadrilateralise_contours",
"remove_stacked_contours",
"DataDetectionColourChecker",
"sample_colour_checker",
]
__all__ += [
"SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC",
"SETTINGS_SEGMENTATION_COLORCHECKER_SG",
"colour_checkers_coordinates_segmentation",
"SETTINGS_SEGMENTATION_COLORCHECKER_NANO",
"segmenter_default",
"extract_colour_checkers_segmentation",
"detect_colour_checkers_segmentation",
]
__all__ += [
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC",
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI",
"inferencer_default",
"detect_colour_checkers_inference",
]

0 comments on commit bcf5811

Please sign in to comment.