predict_breeds.py
def process_predict(self):
        """
        Predict which dog breeds the image is resemble.
        if dog and face are detected on the same image
            - predict dog breeds on the detected dog
            - crop the detected face area on the image and predict dog breeds on the detected face

        if more than one detected faces on the same image
            - crop the detected face area on the image and predict dog breeds on the individual detected face

        if only one face is detected on the same image
            - predict dog breeds on the detected face

        if no dog and human are detected
            - print "No human. No dog."

        Parameters:
            None
        Return:
            None
        """
        rn50_model = rn50()
        iV3_model = iV3(self.img_path)
        dog_filters = df(self.img_path)
        faces, BGR_img = self.Improved_OpenCV_face_detector()
        dogs =  rn50_model.dog_detector(self.img_path)
        #if dog and human in the same image, model predicts dog breeds will always based on the dog
        #so we have to cropped the human image from the dog
        if(dogs != 0):
            print('Hello, dog!')
            u.show_upload_image(self.img_path)
            iV3_model.show_top5_result()
            if(len(faces) > 0):
                cropped_imgs = u.crop_detected_faces(BGR_img, faces)
                self.detect_face_on_cropped_imgs(cropped_imgs)
                u.delete_cropped_images()
        #if more than one people in the same image, model predicts dog breeds will always show one result
        #so we have to crop the human image to individuals
        else:
            if(len(faces) > 1):
                cropped_imgs = u.crop_detected_faces(BGR_img, faces)
                self.detect_face_on_cropped_imgs(cropped_imgs)
                u.delete_cropped_images()
            elif(len(faces) == 1):
                print('Hello, human!')
                dog_filters.apply_snapchat_filter()
                iV3_model.show_top5_result()
            else:
                print('No human. No dog.')
                u.show_test_image(self.img_path)

        Predict which dog breeds the image is resemble.
        if dog and face are detected on the same image
            - predict dog breeds on the detected dog
            - crop the detected face area on the image and predict dog breeds on the detected face

        if more than one detected faces on the same image
            - crop the detected face area on the image and predict dog breeds on the individual detected face

        if only one face is detected on the same image
            - predict dog breeds on the detected face

        if no dog and human are detected
            - print "No human. No dog."

        Parameters:
            None
        Return:
            None
        
Predict which dog breeds the image is resemble.
if dog and face are detected on the same image
predict dog breeds on the detected dog
crop the detected face area on the image and predict dog breeds on the detected face

if more than one detected faces on the same image
crop the detected face area on the image and predict dog breeds on the individual detected face

if only one face is detected on the same image
predict dog breeds on the detected face

if no dog and human are detected
print "No human. No dog."

None
Return:
None
Predict which dog breeds the image is resemble . if dog and face are detected on the same image predict dog breeds on the detected dog crop the detected face area on the image and predict dog breeds on the detected face if more than one detected faces on the same image crop the detected face area on the image and predict dog breeds on the individual detected face if only one face is detected on the same image predict dog breeds on the detected face if no dog and human are detected print " No human . No dog . " None Return : None
def process_predict(self):
        rn50_model = rn50()
        iV3_model = iV3(self.img_path)
        dog_filters = df(self.img_path)
        faces, BGR_img = self.Improved_OpenCV_face_detector()
        dogs =  rn50_model.dog_detector(self.img_path)
        if(dogs != 0):
            print('Hello, dog!')
            u.show_upload_image(self.img_path)
            iV3_model.show_top5_result()
            if(len(faces) > 0):
                cropped_imgs = u.crop_detected_faces(BGR_img, faces)
                self.detect_face_on_cropped_imgs(cropped_imgs)
                u.delete_cropped_images()
        else:
            if(len(faces) > 1):
                cropped_imgs = u.crop_detected_faces(BGR_img, faces)
                self.detect_face_on_cropped_imgs(cropped_imgs)
                u.delete_cropped_images()
            elif(len(faces) == 1):
                print('Hello, human!')
                dog_filters.apply_snapchat_filter()
                iV3_model.show_top5_result()
            else:
                print('No human. No dog.')
                u.show_test_image(self.img_path)
def process_predict ( self ) : rn50_model = rn50 ( ) iV3_model = iV3 ( self . img_path ) dog_filters = df ( self . img_path ) faces , BGR_img = self . Improved_OpenCV_face_detector ( ) dogs = rn50_model . dog_detector ( self . img_path ) if ( dogs != 0 ) : print ( 'Hello, dog!' ) u . show_upload_image ( self . img_path ) iV3_model . show_top5_result ( ) if ( len ( faces ) > 0 ) : cropped_imgs = u . crop_detected_faces ( BGR_img , faces ) self . detect_face_on_cropped_imgs ( cropped_imgs ) u . delete_cropped_images ( ) else : if ( len ( faces ) > 1 ) : cropped_imgs = u . crop_detected_faces ( BGR_img , faces ) self . detect_face_on_cropped_imgs ( cropped_imgs ) u . delete_cropped_images ( ) elif ( len ( faces ) == 1 ) : print ( 'Hello, human!' ) dog_filters . apply_snapchat_filter ( ) iV3_model . show_top5_result ( ) else : print ( 'No human. No dog.' ) u . show_test_image ( self . img_path )
Predict which dog breeds the image is resemble.
Predict which dog breeds the image is resemble .
"""
        Predict which dog breeds the image is resemble.
        if dog and face are detected on the same image
            - predict dog breeds on the detected dog
            - crop the detected face area on the image and predict dog breeds on the detected face

        if more than one detected faces on the same image
            - crop the detected face area on the image and predict dog breeds on the individual detected face

        if only one face is detected on the same image
            - predict dog breeds on the detected face

        if no dog and human are detected
            - print "No human. No dog."

        Parameters:
            None
        Return:
            None
        """ #if dog and human in the same image, model predicts dog breeds will always based on the dog #so we have to cropped the human image from the dog #if more than one people in the same image, model predicts dog breeds will always show one result #so we have to crop the human image to individuals
self