Imageai: Detection via retina is reverting the photos 90 degrees

Created on 25 Sep 2018  路  6Comments  路  Source: OlafenwaMoses/ImageAI

Hi,

why does retina sometimes revert my pictures 90 degres when detecting object? It doesnt detect almost anything when reverted...

Thx, JS

Most helpful comment

I think this should be closed to keep things clean. Of course it can be reopened later
cc @OlafenwaMoses

All 6 comments

Post the full code you ran here...

from imageai.Detection import ObjectDetection
import os
from IPython.display import Image
from PIL import Image
import numpy as np
os.chdir(...)
input_path = ...
tmp = os.listdir(input_path)

for j in tmp:
input_img = str(j)
execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(os.path.join(execution_path, "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()

custom_objects = detector.CustomObjects(person=False, car=False, bottle=True)
main_obj, detections, extracted_obj = detector.detectCustomObjectsFromImage(
input_image=os.path.join(execution_path, input_path+input_img),
input_type="file",
#                                                   output_type="file",
output_type='array',
output_image_path=os.path.join(execution_path, "im"),
custom_objects=custom_objects,
extract_detected_objects=True,
minimum_percentage_probability=25)

for eachObject in detections:
    print(eachObject["name"], " : ", eachObject["percentage_probability"], " : ")
    print("--------------------------------")

os.mkdir(input_img)
img = Image.fromarray(main_obj, 'RGB')
img.save(input_img + '/main.png')
#img.show()

cntr = 0
for i in extracted_obj:
    try:
        img = Image.fromarray(i, 'RGB')
        img.save('/Users/jakubstech/Documents/detekce/' + input_img + '/extracted' + str(cntr) + '.jpg')
    except ValueError:
        print('error')
    cntr += 1`

@OlafenwaMoses ? :)

Kindly install the latest version of ImageAI
pip3 install imageai --upgrade

Did it solve the issue? Any news on this?

I think this should be closed to keep things clean. Of course it can be reopened later
cc @OlafenwaMoses

Was this page helpful?
0 / 5 - 0 ratings