question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can not get attributes with detector model

See original GitHub issue

My actions before raising this issue

  • Read/searched the docs
  • Searched past issues

Expected Behaviour

I defined label as

[
  {
    "name": "text",
    "id": 1,
    "color": "#20cc1c",
    "attributes": [
      {
        "id": 1,
        "name": "word",
        "input_type": "text",
        "mutable": false,
        "values": [
          ""
        ]
      }
    ]
  }
]

I deployed a text detector with ocr ml model to annotation data, model runs fine, but only polygons was displayed, the attributes was blank.

Current Behaviour

image

[
    {
        "confidence": null,
        "label": "text",
        "points": [
            28,
            19,
            103,
            19,
            103,
            44,
            28,
            44
        ],
        "type": "polygon",
        "attributes": [
            {
                "id": 1,
                "name": "word",
                "input_type": "text",
                "mutable": false,
                "values": "ocr result text"
            }
        ]
    }
    ...

Possible Solution

Steps to Reproduce (for bugs)

  1. text-detector-0004 add attributes to result
  2. modify model_handler.py add return attributes code
for box in pcd.bboxes:
            results.append({
                "confidence": None,
                "label": self.labels.get(obj_class, "unknown"),
                "points": box.ravel().tolist(),
                "type": "polygon",
                # add attributes for test
                "attributes":
                    [
                        {
                            "id": 1,
                            "name": "word",
                            "input_type": "text",
                            "mutable": False,
                            "values": "ocr result text"
                        }
                    ]
                })
  1. deploy text-detector
  2. annotation with text-detector-0004

Context

Your Environment

  • Git hash commit (git log -1):
$ git log -1
commit 8d03ed7959632d6f3ffd76020ad577fa409acfcd
Merge: 56c9626 476b2fc
Author: Nikita Manovich <nikita.manovich@intel.com>
Date:   Fri Sep 17 14:22:09 2021 +0300

    Merge branch 'release-1.6.0'
  • Docker version docker version (e.g. Docker 17.0.05):
$ docker version
Client: Docker Engine - Community
 Version:           20.10.10
 API version:       1.41
 Go version:        go1.16.9
 Git commit:        b485636
 Built:             Mon Oct 25 07:44:50 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.10
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.9
  Git commit:       e2f740d
  Built:            Mon Oct 25 07:43:13 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.11
  GitCommit:        5b46e404f6b9f661a205e28d59c982d3634148f8
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • Are you using Docker Swarm or Kubernetes? No
  • Operating System and version (e.g. Linux, Windows, MacOS):
$ uname -a
Linux ai-research 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Code example or link to GitHub repo or gist to reproduce problem:
  • Other diagnostic information / logs:
    Logs from `cvat` container

Next steps

You may join our Gitter channel for community support.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
yangxiuwucommented, Apr 13, 2022

I found the reason, function.yaml must has attributes describe

metadata:
  name: openvino-omz-intel-text-detection-0004
  namespace: cvat
  annotations:
    name: Text detection v4
    type: detector
    framework: openvino
    spec: |
      [
        { "id": 1, "name": "text",  "attributes": [
          {
            "name": "word",
            "input_type": "text"

          }]
        }
      ]

now it can work correctly, thanks!

0reactions
yangxiuwucommented, Apr 13, 2022

I test the text detect by nuctl, and the result as following:

$ cat input.json | nuctl invoke openvino-omz-intel-text-detection-0004 -c 'application/json'
22.04.13 14:55:32.731    nuctl.platform.invoker (I) Executing function {"method": "POST", "url": "http://:49202", "headers": {"Content-Type":["application/json"],"X-Nuclio-Log-Level":["info"],"X-Nuclio-Target":["openvino-omz-intel-text-detection-0004"]}}
22.04.13 14:55:32.965    nuctl.platform.invoker (I) Got response {"status": "200 OK"}
22.04.13 14:55:32.965                     nuctl (I) >>> Start of function logs
22.04.13 14:55:32.965 intel-text-detection-0004 (I) Run text-detection-0004 model {"time": 1649832932752.3977, "worker_id": "1"}
22.04.13 14:55:32.965                     nuctl (I) <<< End of function logs

> Response headers:
Content-Length = 1626
Server = nuclio
Date = Wed, 13 Apr 2022 06:55:32 GMT
Content-Type = application/json

> Response body:
[
    {
        "confidence": null,
        "label": "text",
        "points": [
            28,
            19,
            103,
            19,
            103,
            44,
            28,
            44
        ],
        "type": "polygon",
        "attributes": [
            {
                "name": "word",
                "value": "ocr result"
            }
        ]
    },
  ...

the output has attributes, but when I use AI tools, the result hasn’t attributes image

Read more comments on GitHub >

github_iconTop Results From Across the Web

can not get attributes with detector model · Issue #3903 - GitHub
I deployed a text detector with ocr ml model to annotation data, model runs fine, but only polygons was displayed, the attributes was...
Read more >
can't find findposition :AttributeError: 'HandDetector' object has ...
Go to the PyCharm menu and open Preferences tab. Search for Project:"Your Project Name" tab and open it. Click on Python Interpreter tab;...
Read more >
Detecting Objects using Unsupervised Parts-based Attributes
This paper presents a new approach to parts-based object detection. Objects are described using a spatial model based on its constituent parts.
Read more >
Attributes and Aliasing - Datadog Docs
Attributes can only be aliased to standard attributes. To respect the JSON structure of logs, it is not possible to have one standard...
Read more >
inspect — Inspect live objects — Python 3.11.1 documentation
getmembers() will only return class attributes defined in the metaclass when the argument is a class and those attributes have been listed in...
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