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

function.yaml for automatic annotation of tags. #6220

Closed
2 tasks done
tommy-hayashida opened this issue Jun 1, 2023 · 6 comments
Closed
2 tasks done

function.yaml for automatic annotation of tags. #6220

tommy-hayashida opened this issue Jun 1, 2023 · 6 comments
Labels
question Further information is requested

Comments

@tommy-hayashida
Copy link

tommy-hayashida commented Jun 1, 2023

My actions before raising this issue

I have written main.py based on the following issue and pull request. #3358 #3896

Can you tell me how to write a function.yaml to auto-annotate tags?
I don't know what should be in annotations.type.

Steps to Reproduce (for bugs)

I filled in that field with tag and deployed it.
However, when I looked at the cvat model list, the deployed function did not appear.

metadata:
  name: exapmle
  namespace: cvat
  annotations:
    name: exapmle
    type: tag
    framework: onnx
    spec: |
      [
        { "id": 0, "name": "zero" },
        { "id": 1, "name": "one" },
        { "id": 2, "name": "two" }
      ]
...
23.06.01 09:52:21.313                     nuctl (I) Function deploy complete ...

Your Environment

  • CVAT version
    無題
  • Docker version docker version (e.g. Docker 17.0.05): Docker 24.0.1
  • Operating System and version (e.g. Linux, Windows, MacOS): server Ubuntu18.04, client Windows10
@bsekachev
Copy link
Member

type can be only detector, interactor, tracker, reid.
In your case the correct value is probably detector.

You do not need special function.yaml for tags.
Just from main.py::handler you need to return list of structures where "type": "tag".

Like this:

results.append({
                "confidence": confidence_value,
                "label": "zero",
                "type": "tag",
            })

@bsekachev bsekachev added the question Further information is requested label Jun 7, 2023
@tommy-hayashida
Copy link
Author

Thanks!
After replacing 'tag' with 'detector' in function.yaml, the model now appears in the CVAT model list.

However, when I run the auto-annotation, I get an error message 'Could not create annotations Error: Object shape must be one of: ["rectangle","polygon","polyline","points","ellipse","cuboid","skeleton","mask"]'.

main.py is written as follows. Is this correct?

    ...
    results = [{'type': 'tag', 'label': infered_label}]
    return context.Response(body=json.dumps(results), headers={},
        content_type='application/json', status_code=200)

@tommy-hayashida
Copy link
Author

I found this issue. #4212
Does this mean there are other codes to add?

@bsekachev
Copy link
Member

  1. You can try running the detector on task (offline mode)
  2. In case with online mode, probably need to modify client code a little bit, because before we have not ever had any detectors returnings tags.

This file: cvat-ui/src/components/annotation-page/standard-workspace/controls-side-bar/tools-control.tsx.

In the simplest case to add something like this:
image

                                if (data.type === ObjectType.TAG) {
                                    return new core.classes.ObjectState({
                                        label: jobLabel,
                                        frame,
                                        objectType: ObjectType.TAG,
                                        source: 'auto',
                                    });
                                }

@tommy-hayashida
Copy link
Author

I modifed tools-control.tsx.
無題

Then I received another error message on CVAT.

Detection error occurred
Error: Request failed with status code 503. "HTTPConnectionPool(host='host.docker.internal', port=32769): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.co
nnection.HTTPConnection object at 0x7f390045f190>: Failed to establish a new connection: [Errno 111] Connection refused'))".

@bsekachev
Copy link
Member

Try to remove the function and deploy it again.

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

No branches or pull requests

2 participants