-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
TypeError in automatic annotations with tag #4212
Comments
For reproducibility, you can modify this part of code: https://github.com/openvinotoolkit/cvat/blob/develop/serverless/openvino/omz/public/yolo-v3-tf/nuclio/model_handler.py#L153
|
I get the same problem, maybe it's caused by cvat_ui. Since the code of auto-annotation is updated without modifying the ui code. const states = result.map(
(data: any): any => new core.classes.ObjectState({
shapeType: data.type,
label: jobInstance.labels.filter((label: any): boolean => label.name === data.label)[0],
points: data.points,
objectType: ObjectType.SHAPE,
frame,
occluded: false,
source: 'auto',
attributes: (data.attributes as { name: string, value: string }[])
.reduce((mapping, attr) => {
mapping[attrsMap[data.label][attr.name]] = attr.value;
return mapping;
}, {} as Record<number, string>),
zOrder: curZOrder,
}),
);
createAnnotations(jobInstance, frame, states); Knowing how to modify this code may solve the problem |
Even if you send send points you'll still get error because type cannot be tag, it's supposed to be shape:
One option could be to allow objectType be defined in response you send from serverless model. I'm not sure if it wouldn't break any other things, I haven't tested it and not sure that shapeType rectangle will work objectType tag, just a wild guess. const states = result.map(
(data: any): any => new core.classes.ObjectState({
shapeType: data.type,
label: jobInstance.labels.filter((label: any): boolean => label.name === data.label)[0],
points: data.points,
objectType: data.objectType ?? ObjectType.SHAPE,
frame,
occluded: false,
source: 'auto',
attributes: (data.attributes as { name: string, value: string }[])
.reduce((mapping, attr) => {
mapping[attrsMap[data.label][attr.name]] = attr.value;
return mapping;
}, {} as Record<number, string>),
zOrder: curZOrder,
}),
); And response from serverless model would look like this: {
"confidence": "1.00",
"label": "detection_label",
"type": "rectangle",
"objectType": "tag",
"points": [0, 0, 100, 100],
"attributes": [],
} |
I am looking for this feature support... Basically there will some DeepLearning classification model which I would to run (possibly as detector) and tag the image to have all those classes... Idea is to run the automation task using a classification model to tag all the frames or images. Definitely want to use tag rather than hacking object shape to be rectangle etc.. so that annotators won't get confused and continue using Tags from CVAT Any help on this? Any pointers to modify the code also works for now.. |
any luck on modifying the UI code to support creating Tags? |
If you want to return tags from an annotation model, add objectType to model response and server response (need to check that cvat server also passes this to response). return new core.classes.ObjectState({
shapeType: data.type,
label: jobLabel,
points: data.points,
objectType: data.objectType || ObjectType.SHAPE,
frame,
occluded: data.occluded || false,
source: 'auto',
attributes: (data.attributes as { name: string, value: string }[])
.reduce((acc, attr) => {
const [modelAttr] = Object.entries(body.mapping[modelLabel].attributes)
.find((value: string[]) => value[1] === attr.name) || [];
const areCompatible = checkAttributesCompatibility(
model.attributes[modelLabel].find((mAttr) => mAttr.name === modelAttr),
jobLabel.attributes.find((jobAttr: Attribute) => (
jobAttr.name === attr.name
)),
attr.value,
);
if (areCompatible) {
acc[attrsMap[data.label][attr.name]] = attr.value;
}
return acc;
}, {} as Record<number, string>),
zOrder: curZOrder,
}); When you are running detectors for the whole task, UI is not matter because all handling and object creating is on the server side. Probably need to modify this file Let me know if you need some more assistance, and of course, you are welcome to open a pull request :) |
I will close the issue for now because I've answered the question, if somebody is able to contribute us the feature of automatic annotation of tags, it would be great. |
I'm trying to add my classifier as a serverless function. But I get "TypeError: Cannot read properties of null (reading 'constructor')" in UI. I have simplified the handler function to the form:
But still getting the same error.
spec in yaml file looks like:
The text was updated successfully, but these errors were encountered: