Almost ready
This commit is contained in:
+3
-2
@@ -1,7 +1,7 @@
|
|||||||
FROM debian:13.3
|
FROM debian:13.3
|
||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y wget libgl1 libglib2.0-0 patchelf
|
RUN apt-get update && apt-get install -y wget libgl1 libglib2.0-0 patchelf git
|
||||||
|
|
||||||
# Copy project files
|
# Copy project files
|
||||||
COPY ./src /src
|
COPY ./src /src
|
||||||
@@ -19,7 +19,8 @@ ENV PATH="/home/student/.local/bin:$PATH"
|
|||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
RUN uv venv --python 3.11
|
RUN uv venv --python 3.11
|
||||||
ENV PATH="/src/.venv/bin:$PATH"
|
ENV PATH="/src/.venv/bin:$PATH"
|
||||||
RUN uv pip install notebook open-iris
|
ENV IRIS_ENV="DEV"
|
||||||
|
RUN uv pip install notebook git+https://github.com/worldcoin/open-iris.git@v1.11.0
|
||||||
RUN patchelf --clear-execstack /src/.venv/lib/python3.11/site-packages/onnxruntime/capi/*.so
|
RUN patchelf --clear-execstack /src/.venv/lib/python3.11/site-packages/onnxruntime/capi/*.so
|
||||||
|
|
||||||
# Launch Jupyter Notebook
|
# Launch Jupyter Notebook
|
||||||
|
|||||||
+97
-207
File diff suppressed because one or more lines are too long
@@ -0,0 +1,205 @@
|
|||||||
|
pipeline_conf = {
|
||||||
|
"metadata": {"pipeline_name": "iris_pipeline", "iris_version": "1.11.0"},
|
||||||
|
"pipeline": [
|
||||||
|
{
|
||||||
|
"name": "segmentation",
|
||||||
|
"algorithm": {"class_name": "iris.MultilabelSegmentation.create_from_hugging_face", "params": {}},
|
||||||
|
"inputs": [{"name": "image", "source_node": "input"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "segmentation_binarization",
|
||||||
|
"algorithm": {"class_name": "iris.MultilabelSegmentationBinarization", "params": {
|
||||||
|
"eyeball_threshold": 0.1,
|
||||||
|
"iris_threshold": 0.1,
|
||||||
|
"pupil_threshold": 0.1,
|
||||||
|
"eyelashes_threshold": 0.1
|
||||||
|
}},
|
||||||
|
"inputs": [{"name": "segmentation_map", "source_node": "segmentation"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vectorization",
|
||||||
|
"algorithm": {"class_name": "iris.ContouringAlgorithm", "params": {}},
|
||||||
|
"inputs": [{"name": "geometry_mask", "source_node": "segmentation_binarization", "index": 0}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "specular_reflection_detection",
|
||||||
|
"algorithm": {"class_name": "iris.SpecularReflectionDetection", "params": {}},
|
||||||
|
"inputs": [{"name": "ir_image", "source_node": "input"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "interpolation",
|
||||||
|
"algorithm": {"class_name": "iris.ContourInterpolation", "params": {}},
|
||||||
|
"inputs": [{"name": "polygons", "source_node": "vectorization"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "distance_filter",
|
||||||
|
"algorithm": {"class_name": "iris.ContourPointNoiseEyeballDistanceFilter", "params": {}},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "polygons", "source_node": "interpolation"},
|
||||||
|
{"name": "geometry_mask", "source_node": "segmentation_binarization", "index": 1},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "eye_orientation",
|
||||||
|
"algorithm": {"class_name": "iris.MomentOfArea", "params": {
|
||||||
|
"eccentricity_threshold": 0.05
|
||||||
|
}},
|
||||||
|
"inputs": [{"name": "geometries", "source_node": "distance_filter"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "eye_center_estimation",
|
||||||
|
"algorithm": {"class_name": "iris.BisectorsMethod", "params": {}},
|
||||||
|
"inputs": [{"name": "geometries", "source_node": "distance_filter"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "smoothing",
|
||||||
|
"algorithm": {"class_name": "iris.Smoothing", "params": {}},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "polygons", "source_node": "distance_filter"},
|
||||||
|
{"name": "eye_centers", "source_node": "eye_center_estimation"},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "geometry_estimation",
|
||||||
|
"algorithm": {
|
||||||
|
"class_name": "iris.FusionExtrapolation",
|
||||||
|
"params": {
|
||||||
|
"circle_extrapolation": {"class_name": "iris.LinearExtrapolation", "params": {"dphi": 0.703125}},
|
||||||
|
"ellipse_fit": {"class_name": "iris.LSQEllipseFitWithRefinement", "params": {"dphi": 0.703125}},
|
||||||
|
"algorithm_switch_std_threshold": 3.5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "input_polygons", "source_node": "smoothing"},
|
||||||
|
{"name": "eye_center", "source_node": "eye_center_estimation"},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "pupil_to_iris_property_estimation",
|
||||||
|
"algorithm": {"class_name": "iris.PupilIrisPropertyCalculator", "params": {}},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "geometries", "source_node": "geometry_estimation"},
|
||||||
|
{"name": "eye_centers", "source_node": "eye_center_estimation"},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "offgaze_estimation",
|
||||||
|
"algorithm": {"class_name": "iris.EccentricityOffgazeEstimation", "params": {}},
|
||||||
|
"inputs": [{"name": "geometries", "source_node": "geometry_estimation"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "occlusion90_calculator",
|
||||||
|
"algorithm": {"class_name": "iris.OcclusionCalculator", "params": {"quantile_angle": 90.0}},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "noise_mask", "source_node": "segmentation_binarization", "index": 1},
|
||||||
|
{"name": "extrapolated_polygons", "source_node": "geometry_estimation"},
|
||||||
|
{"name": "eye_orientation", "source_node": "eye_orientation"},
|
||||||
|
{"name": "eye_centers", "source_node": "eye_center_estimation"},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "occlusion30_calculator",
|
||||||
|
"algorithm": {"class_name": "iris.OcclusionCalculator", "params": {"quantile_angle": 30.0}},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "noise_mask", "source_node": "segmentation_binarization", "index": 1},
|
||||||
|
{"name": "extrapolated_polygons", "source_node": "geometry_estimation"},
|
||||||
|
{"name": "eye_orientation", "source_node": "eye_orientation"},
|
||||||
|
{"name": "eye_centers", "source_node": "eye_center_estimation"},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "noise_masks_aggregation",
|
||||||
|
"algorithm": {"class_name": "iris.NoiseMaskUnion", "params": {}},
|
||||||
|
"inputs": [
|
||||||
|
{
|
||||||
|
"name": "elements",
|
||||||
|
"source_node": [
|
||||||
|
{"name": "segmentation_binarization", "index": 1},
|
||||||
|
{"name": "specular_reflection_detection"},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "normalization",
|
||||||
|
"algorithm": {"class_name": "iris.PerspectiveNormalization", "params": {}},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "image", "source_node": "input"},
|
||||||
|
{"name": "noise_mask", "source_node": "noise_masks_aggregation"},
|
||||||
|
{"name": "extrapolated_contours", "source_node": "geometry_estimation"},
|
||||||
|
{"name": "eye_orientation", "source_node": "eye_orientation"},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "filter_bank",
|
||||||
|
"algorithm": {
|
||||||
|
"class_name": "iris.ConvFilterBank",
|
||||||
|
"params": {
|
||||||
|
"filters": [
|
||||||
|
{
|
||||||
|
"class_name": "iris.GaborFilter",
|
||||||
|
"params": {
|
||||||
|
"kernel_size": [41, 21],
|
||||||
|
"sigma_phi": 7,
|
||||||
|
"sigma_rho": 6.13,
|
||||||
|
"theta_degrees": 90.0,
|
||||||
|
"lambda_phi": 28.0,
|
||||||
|
"dc_correction": True,
|
||||||
|
"to_fixpoints": True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class_name": "iris.GaborFilter",
|
||||||
|
"params": {
|
||||||
|
"kernel_size": [17, 21],
|
||||||
|
"sigma_phi": 2,
|
||||||
|
"sigma_rho": 5.86,
|
||||||
|
"theta_degrees": 90.0,
|
||||||
|
"lambda_phi": 8,
|
||||||
|
"dc_correction": True,
|
||||||
|
"to_fixpoints": True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"probe_schemas": [
|
||||||
|
{"class_name": "iris.RegularProbeSchema", "params": {"n_rows": 16, "n_cols": 256}},
|
||||||
|
{"class_name": "iris.RegularProbeSchema", "params": {"n_rows": 16, "n_cols": 256}},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"inputs": [{"name": "normalization_output", "source_node": "normalization"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "encoder",
|
||||||
|
"algorithm": {"class_name": "iris.IrisEncoder", "params": {}},
|
||||||
|
"inputs": [{"name": "response", "source_node": "filter_bank"}],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bounding_box_estimation",
|
||||||
|
"algorithm": {"class_name": "iris.IrisBBoxCalculator", "params": {}},
|
||||||
|
"inputs": [
|
||||||
|
{"name": "ir_image", "source_node": "input"},
|
||||||
|
{"name": "geometry_polygons", "source_node": "geometry_estimation"},
|
||||||
|
],
|
||||||
|
"callbacks": None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -5,16 +5,18 @@ import matplotlib.pyplot as plt
|
|||||||
|
|
||||||
import iris
|
import iris
|
||||||
|
|
||||||
|
from pipeline import pipeline_conf
|
||||||
|
|
||||||
|
|
||||||
def process(path: str) -> None:
|
def process(path: str) -> None:
|
||||||
path = pathlib.Path(path)
|
path = pathlib.Path(path)
|
||||||
|
|
||||||
iris_pipeline = iris.IRISPipeline(env=iris.IRISPipeline.DEBUGGING_ENVIRONMENT)
|
iris_pipeline = iris.IRISPipeline(env=iris.IRISPipeline.DEBUGGING_ENVIRONMENT, config=pipeline_conf)
|
||||||
iris_visualizer = iris.visualisation.IRISVisualizer()
|
iris_visualizer = iris.visualisation.IRISVisualizer()
|
||||||
|
|
||||||
outputs = []
|
outputs = []
|
||||||
for image_path in (path / "input").iterdir():
|
for image_path in (path / "input").iterdir():
|
||||||
if image_path.suffix != ".png":
|
if image_path.suffix != ".jpg":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
print(f"Processing {image_path}...")
|
print(f"Processing {image_path}...")
|
||||||
@@ -26,8 +28,7 @@ def process(path: str) -> None:
|
|||||||
img_data=image_pixels,
|
img_data=image_pixels,
|
||||||
eye_side=eye_side,
|
eye_side=eye_side,
|
||||||
)
|
)
|
||||||
|
output = iris_pipeline(iris.IRImage(img_data=image_pixels, image_id="image_id", eye_side="right"))
|
||||||
output = iris_pipeline(image_pixels, eye_side=eye_side)
|
|
||||||
|
|
||||||
iris_visualizer.plot_segmentation_map(
|
iris_visualizer.plot_segmentation_map(
|
||||||
ir_image=img,
|
ir_image=img,
|
||||||
@@ -45,16 +46,12 @@ def process(path: str) -> None:
|
|||||||
(path / "geometry").mkdir(parents=True, exist_ok=True)
|
(path / "geometry").mkdir(parents=True, exist_ok=True)
|
||||||
plt.savefig(path / "geometry" / f"{image_path.stem}.png")
|
plt.savefig(path / "geometry" / f"{image_path.stem}.png")
|
||||||
|
|
||||||
iris_visualizer.plot_normalized_iris(
|
|
||||||
normalized_iris=iris_pipeline.call_trace["normalization"],
|
|
||||||
)
|
|
||||||
(path / "normalized").mkdir(parents=True, exist_ok=True)
|
(path / "normalized").mkdir(parents=True, exist_ok=True)
|
||||||
plt.savefig(path / "normalized" / f"{image_path.stem}.png")
|
data = iris_pipeline.call_trace["normalization"].normalized_image
|
||||||
|
plt.imsave(path / "normalized" / f"{image_path.stem}.png", data, cmap='Greys_r')
|
||||||
|
|
||||||
iris_visualizer.plot_iris_template(
|
|
||||||
iris_template=iris_pipeline.call_trace["encoder"],
|
|
||||||
)
|
|
||||||
(path / "template").mkdir(parents=True, exist_ok=True)
|
(path / "template").mkdir(parents=True, exist_ok=True)
|
||||||
plt.savefig(path / "template" / f"{image_path.stem}.png")
|
data = output["iris_template"].iris_codes[0][:, :, 0]
|
||||||
|
plt.imsave(path / "template" / f"{image_path.stem}.png", data, cmap='binary')
|
||||||
|
|
||||||
outputs.append((image_path, img, output))
|
outputs.append((image_path, img, output))
|
||||||
Reference in New Issue
Block a user