Skip to content

Commit

Permalink
Merge branch 'release/v0.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Jan 11, 2024
2 parents 30f1fcf + 6b4ec09 commit 86055a0
Show file tree
Hide file tree
Showing 23 changed files with 5,126 additions and 1,494 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
shell: bash
- name: Test with Pytest
run: |
poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --ignore=$CI_PACKAGE/scripts/inference.py --cov=$CI_PACKAGE $CI_PACKAGE
shell: bash
- name: Upload Coverage to coveralls.io
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.11'
Expand Down
16 changes: 15 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,16 @@ 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>`__,
and was trained on a purposely constructed `dataset <https://huggingface.co/datasets/colour-science/colour-checker-detection-dataset>`__.
- The model has only been trained on *ColorChecker Classic 24* images and will not work with *ColorChecker Nano* or *ColorChecker SG* images.
- 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 +81,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
20 changes: 17 additions & 3 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,27 @@ TODO

- colour_checker_detection/__init__.py

- Line 84 : # TODO: Remove legacy printing support when deemed appropriate.
- Line 92 : # TODO: Remove legacy printing support when deemed appropriate.


- colour_checker_detection/detection/common.py

- Line 126 : # TODO: Update when "Colour" 0.4.5 is released.
- Line 1131 : # TODO: Update when "Colour" 0.4.5 is released.


- colour_checker_detection/detection/tests/test_inference.py

- Line 62 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 66 : # TODO: Enable when "torch" is available on Python 3.12.
- Line 101 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 105 : # TODO: Enable when "torch" is available on Python 3.12.


- colour_checker_detection/detection/tests/test_segmentation.py

- Line 251 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 394 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 59 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 151 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.

About
-----
Expand Down
22 changes: 15 additions & 7 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 All @@ -53,8 +61,8 @@
__application_name__ = "Colour - Checker Detection"

__major_version__ = "0"
__minor_version__ = "1"
__change_version__ = "6"
__minor_version__ = "2"
__change_version__ = "0"
__version__ = ".".join(
(__major_version__, __minor_version__, __change_version__)
)
Expand All @@ -77,7 +85,7 @@
] = _version
colour.utilities.ANCILLARY_RUNTIME_PACKAGES[ # pyright: ignore
"opencv"
] = cv2.__version__ # pyright: ignore
] = cv2.__version__

del _version

Expand Down
64 changes: 61 additions & 3 deletions colour_checker_detection/detection/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,73 @@
from .common import (
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,
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__ = [
"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",
"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",
]
Loading

0 comments on commit 86055a0

Please sign in to comment.