Giter VIP home page Giter VIP logo

Comments (6)

arnaldog12 avatar arnaldog12 commented on August 16, 2024

Hi, @ZaidSaid12
Thank you for the interest. You can take a look at my Medium Article for more details.

from deep-learning.

ZaidSaid12 avatar ZaidSaid12 commented on August 16, 2024

@arnaldog12
First of all, thanks for your quick response, greatly appreciated
I've already read your article before checking the code, you mentioned that you used amazon face detection API, so can you please provide the code for generating the dataset {samples.pkl}, i already followed the hyper link of amazon's api

from deep-learning.

ZaidSaid12 avatar ZaidSaid12 commented on August 16, 2024

I intend to increase the accuracy of this model, but it seems i might need a larger dataset

from deep-learning.

arnaldog12 avatar arnaldog12 commented on August 16, 2024

Hi, @ZaidSaid12
I'm sorry. I looked for the code that generates the dataset this weekend, but I don't have it anymore.

but, I still have the code to work with API. I don't know if still works, but you can try:

import boto3
class AmazonAPI():
    def __init__(self, region='us-east-2'):
        self._api = boto3.client("rekognition", region)
        
    def classify_image(self, image_file):
        return self._api.detect_labels(Image={'Bytes': open(image_file, 'rb').read()})
    
    def detect_faces(self, image_file):
        return self._api.detect_faces(Image={'Bytes': open(image_file, 'rb').read()})
    
    def to_rects(self, json_res, img_size=None):
        assert(img_size), "You must provide img_size as (height, width)"
        assert(len(img_size) == 2), 'img_size must be (height, width)'
        
        height, width = img_size
        rects = []
        for details in json_res['FaceDetails']:
            rect = details['BoundingBox']
            rect_x, rect_y = int(rect['Left']*width), int(rect['Top']*height)
            rect_w, rect_h = int(rect['Width']*width), int(rect['Height']*height)
            rects.append(Rect(rect_x, rect_y, rect_w, rect_h))
        return rects

and the code to parse Amazon responses:

def parser_amazon(json_file):
    pose_dict = json_file['FaceDetails'][0]['Pose']
    return pose_dict['Roll'], pose_dict['Pitch'], pose_dict['Yaw']

I hope it helps!

from deep-learning.

arnaldog12 avatar arnaldog12 commented on August 16, 2024

@ZaidSaid12, just to make sure you get the edited code.

from deep-learning.

ZaidSaid12 avatar ZaidSaid12 commented on August 16, 2024

@arnaldog12
Thank you, greatly appreciated

from deep-learning.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.