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

From cv2.Mat to image #65

Open
kilievich-dmitriy-andreevich opened this issue Sep 22, 2024 · 2 comments
Open

From cv2.Mat to image #65

kilievich-dmitriy-andreevich opened this issue Sep 22, 2024 · 2 comments

Comments

@kilievich-dmitriy-andreevich

Hello dear developers!

I ran into a problem when converting cv2.Mat in the picture

As I understand from your example,

"x": [ [ 1 ], [ 2 ], [ 3 ] ],
"y": [ [ 2 ], [ 3 ], [ 4 ] ],
"z": [ [ 3 ], [ 4 ], [ 5 ] ]

what (x y z) these are (R G B) colors. I'm converting an image like in example, but I get an error:

Response Status: 400 Bad Requests
Response body: {"error": "input images are not an array","error_type":"bad_request_error"}

Do you have any Python code that would be an example of checking from Mat images to json? Thank you in advance

@kilievich-dmitriy-andreevich
Copy link
Author

session content:

HTTP/1.1 200 OK
Content-Type: application/json 
Content-Length: 209

{
  "created_at": 1727025141,
  "execution_count": 0,
  "inputs": {
    "images": "float32[1,3,1024,1024]"
  },
  "last_executed_at": 0,
  "model": "mod_A",
  "option": {
    "cuda": false
  },
  "outputs": {
    "output0": "float32[1,7,21504]"
  },
  "version": "v1"
}

@kibae
Copy link
Owner

kibae commented Sep 27, 2024

Hi, @kilievich-dmitriy-andreevich

When attempting to run the ONNX session, you should send the following JSON as the post data:

{
  "images": [
    // shape 1
    [
      // shape 3
      [
        // shape 1024
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        ... // 1024 arrays
      ],
      [
        // shape 1024
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        ... // 1024 arrays
      ],
      [
        // shape 1024
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        [
          //shape 1024
          0,0,0,0,0,0, ... // 1024 float numbers
        ],
        ... // 1024 arrays
      ]
    ]
  ]
}

There is a (1024, 1024) shape in the data, which I assume refers to the width or height of the image.

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