Imageai: Image Detection File stream and numpy

Created on 14 Aug 2019  路  2Comments  路  Source: OlafenwaMoses/ImageAI

Can you provide some example using those input_types to the detectObjectsFromImage method? I have a PIL image and I'm having a hard time converting it to File Stream or numpy array. Look all over the internet and still not working. Amazing library by the way. I got really impressed how good it is after training my own yolo model

help wanted

Most helpful comment

Found my answer. Keras has some trouble working multithreaded flask is multithread as I'm working command line I just added to flask run --without-threads. There is a way to fix it inside imageai. I will do it as soon as I have the time and submit. For now ... just disable threading will solve it

All 2 comments

this is how I implemented it's a very simple code but I'm still getting this error:
raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("last1/BiasAdd:0", shape=(?, ?, ?, 18), dtype=float32) is not an element of this graph.
I0815 07:51:06.359514 123145486721024 _internal.py:122] 127.0.0.1 - - [15/Aug/2019 07:51:06] "POST /detectbib HTTP/1.1" 500 -
Is it me or there is something wrong?

@app.route('/detectbib', methods=['POST'])
def detectorBib():
    req = request.get_json()
    imgdata = base64.b64decode(req["image"])
    imgTemp =Image.open(io.BytesIO(imgdata))
    img=cv2.cvtColor(np.array(imgTemp), cv2.COLOR_BGR2RGB)
    bibs = bibDetector(img)

def bibDetector(image):
    returned_image, detections = detector.detectObjectsFromImage(input_type="array", 
                                                                 input_image=image, output_type="array",
                                                                 minimum_percentage_probability=30)
    return returned_image

I'm just trying to get to work without having to save every image in the hard disk. I want process 5000 of my own images and saving to the hard disk will generate a lot o IO. If you have any examples on how this should be done(I get the image in a base64 format as a parameter). The Idea is to call this service from my image processing software and identify bibs and badges... as the head of the person

Found my answer. Keras has some trouble working multithreaded flask is multithread as I'm working command line I just added to flask run --without-threads. There is a way to fix it inside imageai. I will do it as soon as I have the time and submit. For now ... just disable threading will solve it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bjente picture bjente  路  3Comments

plenari picture plenari  路  3Comments

Danielv123 picture Danielv123  路  4Comments

Overdoze47 picture Overdoze47  路  3Comments

jakubstech picture jakubstech  路  6Comments