Пример #1
0
def _load_rectangles(job: Job, image_id: str, term: int,
                     detections: dict) -> None:

    progress = 10
    job.update(
        progress=progress,
        status=Job.RUNNING,
        statusComment=
        f"Uploading detections of type rectangles to image {image_id} with terms {term}"
    )

    rectangles = _generate_rectangles(detections)

    # Upload annotations to server
    delta = 85 / len(rectangles)
    annotations = AnnotationCollection()
    for rectangle in rectangles:
        annotations.append(
            Annotation(location=rectangle.wkt,
                       id_image=image_id,
                       id_terms=[term]))
        progress += delta
        job.update(progress=int(progress), status=Job.RUNNING)

    annotations.save()
    progress = 100
    job.update(progress=progress,
               status=Job.TERMINATED,
               statusComment="All detections have been uploaded")
Пример #2
0
def _load_polygons(job: Job, image_id: str, term: int,
                   detections: dict) -> None:

    progress = 10
    job.update(
        progress=progress,
        status=Job.RUNNING,
        statusComment=
        f"Uploading detections of type polygons to image {image_id} with terms {term}"
    )

    polygons = _generate_polygons(detections)

    annotation = Annotation(location=polygons.wkt,
                            id_image=image_id,
                            id_terms=[term]).save()

    progress = 85
    job.update(progress=int(progress), status=Job.RUNNING)

    progress = 100
    job.update(progress=progress,
               status=Job.TERMINATED,
               statusComment="All detections have been uploaded")
Пример #3
0
def _load_multi_class_points(job: Job) -> None:

    progress = 100
    job.update(progress=progress,
               status=Job.TERMINATED,
               statusComment="Job finished")