label-studio icon indicating copy to clipboard operation
label-studio copied to clipboard

YOLO export does not export latest version of annotation.

Open TrueWodzu opened this issue 1 year ago • 4 comments

Describe the bug I've labelled a task but after some time I've decided to annotate some more objects on the image for that task. So I've added new annotation and labelled these objects. However, after exporting to YOLO, the export is ignoring my latest annotation and uses the old one.

Example:

{
	"id": 4082,
	"data": {
		"image": "/data/upload/3/821822e5-MOV2_202305060644_202305060649-000186.jpg"
	},
	"annotations": [
		{
			"id": 3478,
			"created_username": " [email protected], 5",
			"created_ago": "8 months, 2 weeks",
			"completed_by": {
				"id": 5,
				"first_name": "",
				"last_name": "",
				"avatar": null,
				"email": "[email protected]",
				"initials": "ad"
			},
			"result": [
				{
					"id": "Yjs-t_dyqN",
					"type": "rectanglelabels",
					"score": 0.9411808848381043,
					"value": {
						"x": 42.50824847015658,
						"y": 33.16957144806198,
						"width": 8.992752014651236,
						"height": 38.893245769382598,
						"rotation": 0,
						"rectanglelabels": [
							"person"
						]
					},
					"origin": "prediction-changed",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "D1PxFlJeqe",
					"type": "rectanglelabels",
					"score": 0.8767771124839783,
					"value": {
						"x": 43.057713680199267,
						"y": 33.14814814814818,
						"width": 2.816760027592191,
						"height": 5.947664765784132,
						"rotation": 0,
						"rectanglelabels": [
							"head"
						]
					},
					"origin": "prediction-changed",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				}
			],
			"was_cancelled": false,
			"ground_truth": false,
			"created_at": "2023-05-21T18:27:05.360488Z",
			"updated_at": "2023-05-21T18:27:05.360501Z",
			"draft_created_at": null,
			"lead_time": 66.293,
			"import_id": null,
			"last_action": null,
			"task": 4082,
			"project": 3,
			"updated_by": 5,
			"parent_prediction": 4075,
			"parent_annotation": null,
			"last_created_by": null
		},
		{
			"id": 4959,
			"created_username": " [email protected], 5",
			"created_ago": "4 months, 2 weeks",
			"completed_by": {
				"id": 5,
				"first_name": "",
				"last_name": "",
				"avatar": null,
				"email": "[email protected]",
				"initials": "ad"
			},
			"result": [
				{
					"id": "Yjs-t_dyqN",
					"type": "rectanglelabels",
					"score": 0.9411808848381043,
					"value": {
						"x": 42.50824847015658,
						"y": 33.16957144806198,
						"width": 8.992752014651235,
						"height": 38.893245769382598,
						"rotation": 0,
						"rectanglelabels": [
							"person"
						]
					},
					"origin": "prediction-changed",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "D1PxFlJeqe",
					"type": "rectanglelabels",
					"score": 0.8767771124839783,
					"value": {
						"x": 43.057713680199267,
						"y": 33.148148148148177,
						"width": 2.816760027592191,
						"height": 5.947664765784132,
						"rotation": 0,
						"rectanglelabels": [
							"head"
						]
					},
					"origin": "prediction-changed",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "T9Te0chn3U",
					"type": "rectanglelabels",
					"value": {
						"x": 69.15646739829426,
						"y": 44.59193611745882,
						"width": 10.45877031904809,
						"height": 27.50907303821183,
						"rotation": 0,
						"rectanglelabels": [
							"poj_maly"
						]
					},
					"origin": "manual",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "0I1mp96bRA",
					"type": "rectanglelabels",
					"value": {
						"x": 61.96202498232971,
						"y": 23.88175455237224,
						"width": 14.005403390934639,
						"height": 32.84031211027816,
						"rotation": 0,
						"rectanglelabels": [
							"poj_duzy"
						]
					},
					"origin": "manual",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "9SbiYThCvL",
					"type": "rectanglelabels",
					"value": {
						"x": 70.65131912495095,
						"y": 14.595245204618159,
						"width": 11.080553237056968,
						"height": 30.397730388697018,
						"rotation": 0,
						"rectanglelabels": [
							"poj_duzy"
						]
					},
					"origin": "manual",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "usBBScfrSm",
					"type": "rectanglelabels",
					"value": {
						"x": 74.06608029326054,
						"y": 13.123655101614294,
						"width": 7.583362988403005,
						"height": 16.865155046087044,
						"rotation": 0,
						"rectanglelabels": [
							"poj_duzy"
						]
					},
					"origin": "manual",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "oPI9alV8PB",
					"type": "rectanglelabels",
					"value": {
						"x": 74.89037109670559,
						"y": 9.095093959906788,
						"width": 6.594214024268779,
						"height": 15.546716854255444,
						"rotation": 0,
						"rectanglelabels": [
							"poj_duzy"
						]
					},
					"origin": "manual",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "Y6TWzRwtIJ",
					"type": "rectanglelabels",
					"value": {
						"x": 46.21521615793616,
						"y": 10.893238763398028,
						"width": 13.303978128024977,
						"height": 28.085577952477754,
						"rotation": 0,
						"rectanglelabels": [
							"poj_duzy"
						]
					},
					"origin": "manual",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				},
				{
					"id": "koLRn7BbGj",
					"type": "rectanglelabels",
					"value": {
						"x": 58.46598891332299,
						"y": 8.775228798597493,
						"width": 9.865729259026768,
						"height": 17.79132523093106,
						"rotation": 0,
						"rectanglelabels": [
							"poj_duzy"
						]
					},
					"origin": "manual",
					"to_name": "image",
					"from_name": "label",
					"image_rotation": 0,
					"original_width": 1920,
					"original_height": 1080
				}
			],
			"was_cancelled": false,
			"ground_truth": false,
			"created_at": "2023-09-17T12:07:27.584518Z",
			"updated_at": "2024-02-03T11:30:00.882219Z",
			"draft_created_at": null,
			"lead_time": 130.87,
			"import_id": null,
			"last_action": null,
			"task": 4082,
			"project": 3,
			"updated_by": 2,
			"parent_prediction": null,
			"parent_annotation": 3478,
			"last_created_by": null
		}
	],
	"predictions": [
		{
			"id": 4075,
			"model_version": "INITIAL",
			"created_ago": "8 months, 2 weeks",
			"result": [
				{
					"type": "rectanglelabels",
					"score": 0.9411808848381043,
					"value": {
						"x": 42.34375,
						"y": 32.12962962962963,
						"width": 8.802083333333334,
						"height": 39.25925925925926,
						"rectanglelabels": [
							"person"
						]
					},
					"to_name": "image",
					"from_name": "label",
					"model_version": "bald_rogen"
				},
				{
					"type": "rectanglelabels",
					"score": 0.8767771124839783,
					"value": {
						"x": 42.395833333333339,
						"y": 33.14814814814815,
						"width": 3.5937499999999997,
						"height": 5.555555555555555,
						"rectanglelabels": [
							"head"
						]
					},
					"to_name": "image",
					"from_name": "label",
					"model_version": "bald_rogen"
				},
				{
					"type": "rectanglelabels",
					"score": 0.03152666613459587,
					"value": {
						"x": 99.27083333333333,
						"y": 14.537037037037038,
						"width": 0.7291666666666666,
						"height": 3.7962962962962965,
						"rectanglelabels": [
							"head"
						]
					},
					"to_name": "image",
					"from_name": "label",
					"model_version": "bald_rogen"
				}
			],
			"score": 0.616494887818893,
			"cluster": null,
			"neighbors": null,
			"mislabeling": 0,
			"created_at": "2023-05-21T18:25:58.649843Z",
			"updated_at": "2023-05-21T18:25:58.649850Z",
			"task": 4082,
			"project": 3
		}
	]
}

So, firstly there was prediction, from that prediction we have got annotation ID 3478 and from that annotation we have the final one with ID 4959. That one should be exported, but it is not.

Expected behavior Last annotation should be exported.

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: Linux - Docker
  • Label Studio Version 1.11.0

TrueWodzu avatar Feb 03 '24 13:02 TrueWodzu

Yeap, I was struggling with this too. So I had to make a conversion script by myself.

AlexanderKozhevin avatar Mar 19 '24 10:03 AlexanderKozhevin

Why did you create a new annotation instead of editing the old one? If you remove the old one, yolo should export the new.

makseq avatar Mar 19 '24 10:03 makseq

Why did you create a new annotation instead of editing the old one? If you remove the old one, yolo should export the new.

Sorry for late reply. For historic reasons. For example to show someone what he did wrong, to have that in history.

Nonetheless that does not change the fact that LabelStudio should not be picking random annotation when exporting :)

TrueWodzu avatar Jun 28 '24 08:06 TrueWodzu

Yeap, I was struggling with this too. So I had to make a conversion script by myself.

I've ended up with fix in the LabelStudio code.

TrueWodzu avatar Jun 28 '24 08:06 TrueWodzu