@@ -204,18 +204,17 @@ def _annotate_image_or_frame( # noqa: C901, PLR0912, PLR0915
204204 )
205205 )
206206 case ProjectType .KEYPOINT_DETECTION :
207- raise NotImplementedError ("Keypoint annotations are not yet supported" )
208- # for label_name in labels:
209- # x, y = _generate_random_keypoint_coords(media_width=media_width, media_height=media_height)
210- # annotations.append(
211- # create_annotations_inner(
212- # id=str(uuid4()),
213- # shape=CreateImageAnnotationRequestAnnotationsInnerShape(
214- # Keypoint(type="KEYPOINT", x=x, y=y, is_visible=random.choice([True, False]))
215- # ),
216- # labels=[label_req_obj_by_name[label_name]],
217- # )
218- # )
207+ for label_name in labels :
208+ x , y = _generate_random_keypoint_coords (media_width = media_width , media_height = media_height )
209+ annotations .append (
210+ create_annotations_inner (
211+ id = str (uuid4 ()),
212+ shape = CreateImageAnnotationRequestAnnotationsInnerShape (
213+ Keypoint (type = "KEYPOINT" , x = x , y = y , is_visible = random .choice ([True , False ]))
214+ ),
215+ labels = [label_req_obj_by_name [label_name ]],
216+ )
217+ )
219218 case ProjectType .TASK_CHAIN_DETECTION_CLASSIFICATION :
220219 x , y , w , h = _generate_random_bbox_coords (
221220 media_width = media_width ,
0 commit comments