Open BeanBagKing opened 2 weeks ago
Hi,
It's not clear from the request how the project is created and how extra labels are added. I guess the reason might be that your function fetch_project_labels
fetches just the 1st page of the results. Try to use cvat_sdk.core.helpers.get_paginated_collection
or this snippet:
from cvat_sdk import make_client
with make_client(...) as client:
project = client.projects.retrieve(42)
print(project.get_labels())
SDK docs: https://docs.cvat.ai/docs/api_sdk/sdk/highlevel-api/ and https://docs.cvat.ai/docs/api_sdk/sdk/lowlevel-api/
I'm not sure it matters how the project is created or how extra labels are added, though in both cases I would have done it via the web interface. Like I said I can't be positive that this is even exactly what's going on here. The behavior matches though.
Regarding the first page of results, I don't believe there is any other pages, or at least none returned by that API that I see. Specifically, it gets the project data from client.projects.retrieve(project_id)
, which returns JSON containing a url to retrieve lables 'labels': {'url': 'https://app.cvat.ai/api/labels?project_id=123456'},
, calling that URL in turn returns a single JSON string of just the label ID and label, no other information, no indication of a second page, nothing else.
I did find a better way to get the labels, so this isn't a stopper for me and I don't even remember how I ended up in that area to get the labels. I think it is a bug though, I'm just not sure what the proper fix is:
We need a reproducing example to be able to help, that's why I asked about how the task was created. Could you provide a full example? E.g. a full python script that creates a task and then retrieves incomplete labels? If it's on app.cvat.ai, you can write to our dedicated support channel (https://www.cvat.ai/ -> Company -> Contact Us.
Actions before raising this issue
Steps to Reproduce
Expected Behavior
The project labels across any api match the current constructor
Possible Solution
Have the source of https://app.cvat.ai/api/labels?project_id= updated and/or have it serve the labels list api.
Context
I was trying to write a script to give me basic statistics on my project (labels per class, etc.). The following script is rather longer than it needs to be with all the debugging, but it will return the results:
The following is a sanitized version of the logs that are written:
Missing from the Project-level labels on the last line are 6: Car, 7: Truck, and 8: Van Again, sanitized, but the missing labels are in a similar numerical order. That is what leads me to believe it is the ones added after I started the project that are missing, though I can't be positive.
However, taking a page directly from the API documentation and creating the following script:
Gets me the literal output of the raw constructor from the project page, with all 8 labels.
Environment