image classification output for Yolo


I have two questions?

  1. How do I take the jsonl output of my annotations for image and convert to Yolo model to be run as inference?
  2. How do I create my own labels/classifiers as a trained model for Prodigy?


Please disregard as I didn’t realize I needed the teach functionality in recipe for image training. Plus manual annotations is not there yet for label creation as I understood based on release dates. I might have to add my own.

Yes, it doesn't yet work out of the box, but you can still use Prodigy to train an image model in the loop. We did experiment with the YOLO models a lot (and even wrote our own little Python wrapper for Darknet – but it's not that stable). With Prodigy, we first wanted to focus on the NLP capabilities, since this is what we know best – but computer vision is definitely on our radar and something we're actively working on for both the downloadable tool, as well as the upcoming annotation manager.

I'm going into more details on this in my post on this thread, including some code examples for integrating your own model, Prodigy's image format, tips and tricks etc:

Also, if you end up using the VGG Image Annotator (a free, web-based tool published by Oxford Researchers, which is pretty neat), here's a simple Prodigy recipe I wrote that takes the created annotations and converts them to Prodigy's JSON format:

# coding: utf8
from __future__ import unicode_literals, print_function

import ujson
from pathlib import Path
from prodigy import recipe, log

        input_file=("VIA input file (JSON)", "positional", None, str),
        output_file=("Optional output file", "positional", None, str),
        separate_regions=("Create one task with one span per region, instead "
                          "of one task with all regions", "flag", "S", bool),
        fetch_images=("Replace URLs and paths with base64-encoded data URIs",
                      "flag", "I", bool))
def convert_via(input_file, output_file=None, separate_regions=False,
    Convert bounding boxes generated by the Oxford VGG group's Image
    Annotator (VIA): Supports
    the file attributes 'image', 'width', 'height' and 'text', as well as the
    region attributes 'label' and 'color'. If no output is specified, the
    examples will be printed, so they can be piped forward to another recipe.
    Currently only supports rectangles and polygon shapes, not circles or
    log("RECIPE: Starting recipe image.convert-via", locals())

    def get_via_span(region):
        x = region['shape_attributes']['all_points_x']
        y = region['shape_attributes']['all_points_y']
        span = {'points': list(zip(x, y))}
        attrs = region.get('region_attributes', {})
        for attr in ('label', 'color'):
            if attr in attrs:
                span[attr] = attrs[attr]
        return span

    with Path(input_file).open('r', encoding='utf8') as f:
        data = ujson.load(f)
    log("RECIPE: Converting data for {} images".format(len(data)),
    examples = []
    for image in data.values():
        task = {'image': image['filename'], 'meta': {}}
        file_attrs = image['file_attributes']
        for attr in ('image', 'width', 'height', 'text'):
            if attr in file_attrs:
                task[attr] = file_attrs[attr]
        for attr in ('source', 'by', 'url'):
            if attr in file_attrs:
                task['meta'][attr] = file_attrs[attr]
        regions = image['regions'].values()
        if separate_regions:
            log("RECIPE: Creating one example per image region")
            for region in regions:
                eg = dict(task)
                eg['spans'] = [get_via_span(region)]
            log("RECIPE: Creating one example per image with one span for "
                "each region")
            task['spans'] = [get_via_span(region) for region in regions]
    if output_file:
        output = [ujson.dumps(line, escape_forward_slashes=False)
                  for line in examples]
        Path(output_file).open('w', encoding='utf-8').write('\n'.join(output))
        print("Created {} tasks from {} annotated images."
              .format(len(examples), len(data)), output_file)
        log("RECIPE: Printing {} converted examples".format(len(examples)))
            for eg in examples:
                print(ujson.dumps(eg, escape_forward_slashes=False))
        except KeyboardInterrupt:

WOW! Thank you so much!

I can’t wait to get Tensorflow :wink: