File size: 367 Bytes
a10e1b9
d601a6b
a10e1b9
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import numpy as np
from backend.ml.mobilenet import extract_features as _extract_features_torch


def extract_features(img):
    """
    img: numpy array (H, W, 3) in RGB uint8 or float32
    returns: 1D feature vector (numpy)
    """
    return _extract_features_torch(img)


def batch_features(images):
    return np.array([extract_features(img) for img in images])