matsui528 / sis

Simple image search engine

Home Page:http://yusukematsui.me/project/sis/sis.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can use face to array in feature_extractor.py?

arpsyapathy opened this issue · comments

Hello!

In this super repository python script feature_extractor.py make array from all image with Keras.
I want processing faces off 10 peoples. But i want get array from faces of this people.
Is it possible in this? With dlib?
Thank you advance

You should detect faces first, then extract features from the detected face areas

@matsui528

In this?

    def extract(self, img):  # img is from PIL.Image.open(path) or keras.preprocessing.image.load_img(path)
        img = img.resize((224, 224))  # VGG must take a 224x224 img as an input
        img = img.convert('RGB')  # Make sure img is color
        x = image.img_to_array(img)  # To np.array. Height x Width x Channel. dtype=float32
        x = np.expand_dims(x, axis=0)  # (H, W, C)->(1, H, W, C), where the first elem is the number of img
        x = preprocess_input(x)  # Subtracting avg values for each pixel

@matsui528
Can I see these coordinates on the photo? Show image using PIL?

You can crop a face region by some face detector, and put it to the above extract function. You might need to convert the data little bit, or you can re-write the extract function so as to accept your data.