Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Array as output data #15

Open
warddeboeck opened this issue Jun 25, 2020 · 5 comments
Open

Array as output data #15

warddeboeck opened this issue Jun 25, 2020 · 5 comments

Comments

@warddeboeck
Copy link

warddeboeck commented Jun 25, 2020

Hi there,

I'm trying to get out the output data of the Runway Model "Keras-OCR" running locally. It seems link with Runway is set up correctly as I see the output at http://localhost:8000/data.
However I can't seem to reach it in Openframeworks.
offApp.h:

ofxRunway runway;
string runwayResult;

ofApp.cpp:
runway.get("bboxes", runwayResult);

Error:
Screenshot 2020-06-25 at 12 53 38

Input and output specification Runway model:
Screenshot 2020-06-25 at 13 03 39

runway.getOutputTypes() gives:

[
    {
        "description": null,
        "itemType": {
            "description": null,
            "name": "image_bounding_box_array_item",
            "type": "image_bounding_box"
        },
        "minLength": 0,
        "name": "bboxes",
        "type": "array"
    },
    {
        "description": null,
        "itemType": {
            "default": "",
            "description": null,
            "minLength": 0,
            "name": "text_array_item",
            "type": "text"
        },
        "minLength": 0,
        "name": "labels",
        "type": "array"
    }
]

How do I get out the array with ofxRunway?

@roymacdonald
Copy link
Collaborator

Hi, that's not how it works. ofxRunway will parse those strings into the data type that those represent.
I just added some examples on how to use Keras-OCR.
Let me know if this is ok or if you still need to access the raw data.

@warddeboeck
Copy link
Author

Hi Roy, I would indeed like to get the raw data! To check those strings/text on certain words.

@roymacdonald
Copy link
Collaborator

Hi @warddeboeck
That is already accessible.

so instead of running runway.get(...); you need to run the following

	ofxRunwayData dataToReceive;
	while (runway.tryReceive(dataToReceive)) {
//		 dataToReceive.data contains the raw JSON data sent by runway. And it is here where you should perform what ever you need with it.
		break;
	}
	

@warddeboeck
Copy link
Author

Aha thanks, I see!

@roymacdonald
Copy link
Collaborator

sure, no problem. I will close this issue and add a note about this in the readme.
Just if you are curious, take a look at ofxRunway.cpp and ofxRunwayData.cpp and you'll notice how most get functions are wrapping the chunck of code I just posted.
cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants