Giter Club home page Giter Club logo

Comments (4)

PushpakBhoge avatar PushpakBhoge commented on June 2, 2024 1

@youth123-c the download apis are normally async 202 means task submitted. it is actually a success response

you will find the backup file on some other API in UI the javascrip generally take care of this, I don't know which is the second API in case of CVAT but I based of network observation you have to keep hitting same request until you get 201 with param action='download'.

even if you put your request in while with this param I don't thik it will work
I will recommend using the cvat sdk pip install cvat-sdk==2.1.0
https://docs.cvat.ai/docs/api_sdk/sdk/highlevel-api/

here one example

from cvat_sdk import make_client, models
with make_client(host=CVAT_HOST, credentials=(CVAT_USER, CVAT_PASS)) as client:
    task_meta = client.tasks.retrieve(download_task_id)
    task_meta.export_dataset(format_name="CVAT for images 1.1", filename=local_path)

from cvat.

youth123-c avatar youth123-c commented on June 2, 2024

Thank you very much for your help, I will try it using cvat sdk

from cvat.

bsekachev avatar bsekachev commented on June 2, 2024

Did you sort out how to work with backup API?

from cvat.

youth123-c avatar youth123-c commented on June 2, 2024
 def download_annotation(
        self,
        download_task_id,
        account_name,
        container_name,
        file_format,
    ):
        """Download annotation with CVAT SDK.
        Args:
            download_task_id: Task id.
            account_name: Azure Blob Storage account name.
            container_name: Azure Blob Storage container name.
            file_format: Type of annotation file.
            CVAT_HOST: CVAT host.
            CVAT_USER: CVAT username.
            CVAT_PASS: CVAT password.
        """
        try:
            with make_client(
                host=self.request_url, credentials=(self.username, self.password)
            ) as client:
                task_meta = client.tasks.retrieve(download_task_id)
                # Get the current date and time
                now = datetime.now()
                # Format the date and time
                dt_string = now.strftime("%y%m%d%H%M%S")
                local_path = f"{download_task_id}_{dt_string}.zip"
                parsed_url = urlparse(self.request_url)
                hostname = parsed_url.hostname.split(".")[0]
                blob_path = f"cvat_backup/{hostname}/{download_task_id}/{local_path}"
                task_meta.export_dataset(format_name=file_format, filename=local_path)
                return True
        except Exception as e:
            logging.error("Error downloading annotations: %s", str(e))
            return False

I used cavt sdk to download the task, but I found that the export_dataset method downloads image and annotation. If I only want to download annotation, I should use that method?

from cvat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.