Skip to content

Commit 86055a0

Browse files
committed
Merge branch 'release/v0.2.0'
2 parents 30f1fcf + 6b4ec09 commit 86055a0

23 files changed

+5126
-1494
lines changed

.github/workflows/continuous-integration-quality-unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
shell: bash
5454
- name: Test with Pytest
5555
run: |
56-
poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --cov=$CI_PACKAGE $CI_PACKAGE
56+
poetry run python -W ignore -m pytest --doctest-modules --ignore=$CI_PACKAGE/examples --ignore=$CI_PACKAGE/scripts/inference.py --cov=$CI_PACKAGE $CI_PACKAGE
5757
shell: bash
5858
- name: Upload Coverage to coveralls.io
5959
if: matrix.os == 'macOS-latest' && matrix.python-version == '3.11'

README.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,16 @@ Features
3939

4040
The following colour checker detection algorithms are implemented:
4141

42-
- Segmentation
42+
- Segmentation
43+
- Machine learning inference via `Ultralytics YOLOv8 <https://github.com/ultralytics/ultralytics>`__
44+
45+
- The model is published on `HuggingFace <https://huggingface.co/colour-science/colour-checker-detection-models>`__,
46+
and was trained on a purposely constructed `dataset <https://huggingface.co/datasets/colour-science/colour-checker-detection-dataset>`__.
47+
- The model has only been trained on *ColorChecker Classic 24* images and will not work with *ColorChecker Nano* or *ColorChecker SG* images.
48+
- Inference is performed by a script licensed under the terms of the
49+
*GNU Affero General Public License v3.0* as it uses the
50+
*Ultralytics YOLOv8* API which is incompatible with the
51+
*BSD-3-Clause*.
4352

4453
Examples
4554
^^^^^^^^
@@ -72,6 +81,11 @@ Primary Dependencies
7281
- `opencv-python >= 4, < 5 <https://pypi.org/project/opencv-python>`__
7382
- `scipy >= 1.8, < 2 <https://pypi.org/project/scipy>`__
7483

84+
Secondary Dependencies
85+
~~~~~~~~~~~~~~~~~~~~~~
86+
87+
- `ultralytics >= 8, < 9 <https://pypi.org/project/ultralytics>`__
88+
7589
Pypi
7690
~~~~
7791

TODO.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,27 @@ TODO
66

77
- colour_checker_detection/__init__.py
88

9-
- Line 84 : # TODO: Remove legacy printing support when deemed appropriate.
9+
- Line 92 : # TODO: Remove legacy printing support when deemed appropriate.
10+
11+
12+
- colour_checker_detection/detection/common.py
13+
14+
- Line 126 : # TODO: Update when "Colour" 0.4.5 is released.
15+
- Line 1131 : # TODO: Update when "Colour" 0.4.5 is released.
16+
17+
18+
- colour_checker_detection/detection/tests/test_inference.py
19+
20+
- Line 62 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
21+
- Line 66 : # TODO: Enable when "torch" is available on Python 3.12.
22+
- Line 101 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
23+
- Line 105 : # TODO: Enable when "torch" is available on Python 3.12.
1024

1125

1226
- colour_checker_detection/detection/tests/test_segmentation.py
1327

14-
- Line 251 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
15-
- Line 394 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
28+
- Line 59 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
29+
- Line 151 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
1630

1731
About
1832
-----

colour_checker_detection/__init__.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020
import numpy as np
2121

2222
from .detection import (
23+
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC,
24+
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI,
2325
SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC,
26+
SETTINGS_SEGMENTATION_COLORCHECKER_NANO,
2427
SETTINGS_SEGMENTATION_COLORCHECKER_SG,
25-
colour_checkers_coordinates_segmentation,
28+
detect_colour_checkers_inference,
2629
detect_colour_checkers_segmentation,
27-
extract_colour_checkers_segmentation,
30+
inferencer_default,
31+
segmenter_default,
2832
)
2933

3034
__author__ = "Colour Developers"
@@ -35,11 +39,15 @@
3539
__status__ = "Production"
3640

3741
__all__ = [
42+
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC",
43+
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI",
3844
"SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC",
45+
"SETTINGS_SEGMENTATION_COLORCHECKER_NANO",
3946
"SETTINGS_SEGMENTATION_COLORCHECKER_SG",
40-
"colour_checkers_coordinates_segmentation",
41-
"extract_colour_checkers_segmentation",
47+
"detect_colour_checkers_inference",
4248
"detect_colour_checkers_segmentation",
49+
"inferencer_default",
50+
"segmenter_default",
4351
]
4452

4553
ROOT_RESOURCES: str = os.path.join(os.path.dirname(__file__), "resources")
@@ -53,8 +61,8 @@
5361
__application_name__ = "Colour - Checker Detection"
5462

5563
__major_version__ = "0"
56-
__minor_version__ = "1"
57-
__change_version__ = "6"
64+
__minor_version__ = "2"
65+
__change_version__ = "0"
5866
__version__ = ".".join(
5967
(__major_version__, __minor_version__, __change_version__)
6068
)
@@ -77,7 +85,7 @@
7785
] = _version
7886
colour.utilities.ANCILLARY_RUNTIME_PACKAGES[ # pyright: ignore
7987
"opencv"
80-
] = cv2.__version__ # pyright: ignore
88+
] = cv2.__version__
8189

8290
del _version
8391

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,73 @@
1+
from .common import (
2+
DTYPE_INT_DEFAULT,
3+
DTYPE_FLOAT_DEFAULT,
4+
SETTINGS_DETECTION_COLORCHECKER_CLASSIC,
5+
SETTINGS_DETECTION_COLORCHECKER_SG,
6+
SETTINGS_CONTOUR_DETECTION_DEFAULT,
7+
as_int32_array,
8+
as_float32_array,
9+
swatch_masks,
10+
swatch_colours,
11+
reformat_image,
12+
transform_image,
13+
detect_contours,
14+
is_square,
15+
contour_centroid,
16+
scale_contour,
17+
approximate_contour,
18+
quadrilateralise_contours,
19+
remove_stacked_contours,
20+
DataDetectionColourChecker,
21+
sample_colour_checker,
22+
)
23+
from .inference import (
24+
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC,
25+
SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI,
26+
inferencer_default,
27+
detect_colour_checkers_inference,
28+
)
29+
130
from .segmentation import (
231
SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC,
332
SETTINGS_SEGMENTATION_COLORCHECKER_SG,
4-
colour_checkers_coordinates_segmentation,
5-
extract_colour_checkers_segmentation,
33+
SETTINGS_SEGMENTATION_COLORCHECKER_NANO,
34+
segmenter_default,
635
detect_colour_checkers_segmentation,
736
)
837

938
__all__ = [
39+
"DTYPE_INT_DEFAULT",
40+
"DTYPE_FLOAT_DEFAULT",
41+
"SETTINGS_DETECTION_COLORCHECKER_CLASSIC",
42+
"SETTINGS_DETECTION_COLORCHECKER_SG",
43+
"SETTINGS_CONTOUR_DETECTION_DEFAULT",
44+
"as_int32_array",
45+
"as_float32_array",
46+
"swatch_masks",
47+
"swatch_colours",
48+
"reformat_image",
49+
"transform_image",
50+
"detect_contours",
51+
"is_square",
52+
"contour_centroid",
53+
"scale_contour",
54+
"approximate_contour",
55+
"quadrilateralise_contours",
56+
"remove_stacked_contours",
57+
"DataDetectionColourChecker",
58+
"sample_colour_checker",
59+
]
60+
__all__ += [
1061
"SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC",
1162
"SETTINGS_SEGMENTATION_COLORCHECKER_SG",
12-
"colour_checkers_coordinates_segmentation",
63+
"SETTINGS_SEGMENTATION_COLORCHECKER_NANO",
64+
"segmenter_default",
1365
"extract_colour_checkers_segmentation",
1466
"detect_colour_checkers_segmentation",
1567
]
68+
__all__ += [
69+
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC",
70+
"SETTINGS_INFERENCE_COLORCHECKER_CLASSIC_MINI",
71+
"inferencer_default",
72+
"detect_colour_checkers_inference",
73+
]

0 commit comments

Comments
 (0)