File size: 451 Bytes
83b7436
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import numpy as np
from PIL import Image

from autocatalog.data.preprocessing import (
    COLOR_FEATURE_DIM,
    extract_color_features,
)


def test_color_feature_shape_and_values():
    image = Image.new(
        "RGB",
        (128, 128),
        color=(255, 0, 0),
    )

    features = extract_color_features(image)

    assert features.shape == (COLOR_FEATURE_DIM,)
    assert features.dtype == np.float32
    assert np.isfinite(features).all()