"No media data found" when trying to create a task via SDK

See original GitHub issue

My actions before raising this issue

  • Read/searched the docs
  • Searched past issues

I want to create a task including a file from shared disk via the SDK, but i receive a error that the file is not found:

Error: Request failed with status code 500. “ValueError: No media data found\n”.

Expected Behaviour

The Task should be created

Current Behaviour

No task creation possible.

Possible Solution

I think there is a error in the shared files implementation. Could it be that there is a error in the file path generation with the Quotation marks as seen in the log of the buttom of the issue ? Looks suspicous to me, but beside the quotation marks the path would be correct.

Steps to Reproduce (for bugs)

  1. Create a uploader script
from cvat_sdk import make_client, models
from cvat_sdk.core.proxies.tasks import ResourceType, Task

user="xxx"
pw="xxx"
host="xxx"

# Create a Client instance bound to a local server and authenticate using basic auth
with make_client(host=host, credentials=(user, pw), port=8080) as client:
    # Let's create a new task.

    # Fill in task parameters first.
    # Models are used the same way as in the layer 1.
    task_spec = {
        "name": "example task",
        "labels": [
            {
                "name": "car",
                "color": "#ff00ff",
                "attributes": [
                    {
                        "name": "a",
                        "mutable": True,
                        "input_type": "number",
                        "default_value": "5",
                        "values": ["4", "5", "6"],
                    }
                ],
            }
        ],
    }
    oneFile ="flightdata/2022-08-13T09-00-00-payload-images-helgoland/cam-l/2022-06-15T08-21-49.975755.jpg" # i am not 100perc sure about this, but i created a task via UI including this file and used the shared folder path which was shown in UI on the top
    task = client.tasks.create_from_data(
        spec=task_spec,
        resource_type=ResourceType.SHARE,
        resources=[oneFile]
    )
    
  1. Run the script
  2. Response:
(cvat) xxx@asfasf:~/cvat_task_creator$ python3 creator.py 
Traceback (most recent call last):
  File "/rzhome/xxx/cvat_task_creator/creator.py", line 42, in <module>
    task = client.tasks.create_from_data(
  File "/rzhome/xxx/miniconda3/envs/cvat/lib/python3.9/site-packages/cvat_sdk/core/proxies/tasks.py", line 311, in create_from_data
    raise exceptions.ApiException(
cvat_sdk.api_client.exceptions.ApiException: Status Code: 200
Reason: OK
HTTP response headers: HTTPHeaderDict({'Allow': 'GET, HEAD, OPTIONS', 'Content-Length': '77', 'Content-Type': 'application/vnd.cvat+json', 'Date': 'Thu, 03 Nov 2022 18:52:43 GMT', 'Referrer-Policy': 'same-origin', 'Server': 'Apache', 'Vary': 'Accept,Origin', 'X-Content-Type-Options': 'nosniff', 'X-Frame-Options': 'DENY'})
HTTP response body: b'{"state":"Failed","message":"ValueError: No media data found","progress":0.0}'

Context

I want to create tasks automatically without using the UI, the folders with the images include also other files . In the UI its too much work explicitly excluding all non-images, so i want to have a SDK way to create tasks. The CLI also doesnt work for me due to https://github.com/opencv/cvat/issues/4962 ( i think i need to wait for the next release be able to use it?)

Your Environment

  • Running via CVAT_VERSION=dev docker-compose up -d
  • Git hash commit (git log -1):
commit 2311b10b800a5c564af3af547472541e9b9b7cde (HEAD -> develop, origin/develop, origin/HEAD)                                                                          
Author: Anastasia Yasakova <yasakova_anastasiya@mail.ru>
Date:   Fri Oct 21 12:52:36 2022 +0300

    Fix an issue with Imagenet dataset import (#4861)

  • Docker version docker version (e.g. Docker 17.0.05): Docker 20.10.12
  • Are you using Docker Swarm or Kubernetes? No
  • Operating System and version (e.g. Linux, Windows, MacOS): Debian
  • Code example or link to GitHub repo or gist to reproduce problem: No
  • Other diagnostic information / logs:

django@c58e8b630737:~$ cat logs/cvat_server.log 
....
[2022-11-03 18:52:38,760] INFO cvat.server: create task #117
[2022-11-03 18:52:38,766] WARNING cvat.server: Skip '/home/django/share/"flightdata/2022-08-13T09-00-00-payload-images-helgoland/cam-l/2022-06-15T08-21-49.975755.jpg"' file (its mime type doesn't correspond to supported MIME file type)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
SpecLadcommented, Nov 7, 2022

I’ve tried running your reproduction script with the development version of the SDK (swapping out the image path for my own), and it worked for me. So make sure you’re using the development version of the SDK. For example, check cvat_sdk/core/proxies/tasks.py and make sure it has no mentions of “multipart”.

0reactions
julledcommented, Nov 5, 2022

I think (not expert in this) i was able to compile the sdk on my own using the official schema from https://app.cvat.ai/api/docs/ and the howto from https://opencv.github.io/cvat/docs/api_sdk/sdk/developer-guide/

But i still get the same problem in the log:

[2022-11-05 16:55:49,722] WARNING cvat.server: Skip '/home/django/share/"flightdata/2022-08-13T09-00-00-payload-images-helgoland/cam-l/2022-06-15T08-21-49.975755.jpg"' file (its mime type doesn't correspond to supported MIME file type)

Does this mean that the SDK recompilation cant be succesful or the issue might be somewhere else?

When will be the 2.3 pypi sdk release with the bugfix?

Read more comments on GitHub >

github_iconTop Results From Across the Web

opencv-cvat/public - Gitter
The third day I already try and get No media data found ... First you need to make task create request /api/v1/tasks (response...
Read more >
Engagements | Tasks - HubSpot Developers
You can create tasks in HubSpot or via the tasks API. Below, learn the basic methods of managing tasks through the API. To...
Read more >
Tasks - Amazon Connect - AWS Documentation
Amazon Connect Tasks allows you to prioritize, assign, track, and even automate tasks across the disparate tools agents use to support customers.
Read more >
CVAT Integration — FiftyOne 0.18.0 documentation - Voxel51
FiftyOne provides an API to create tasks and jobs, upload data, define label schemas, ... If you have not stored your login credentials...
Read more >
Enhance your Flex Insights Integration with Additional Data
Media links (links to recordings for example) can be updated 2 minutes after task is completed. After 2 minutes the task is deleted...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found