コード例 #1
0
    def test_define_list(self):
        Config.clear()
        Config.define_float_list("test_float", [5., 6, "7."],
                                 "A test for float")
        Config.define_int_list("test_int_float_valid", [5., 5],
                               "A test for int with a float var")
        Config.define_str_list("str", [], "A test for int with a float var")

        self.assertDictEqual(
            Config.get_dict(), {
                'test_float': [5.0, 6.0, 7.0],
                'test_int_float_valid': [5, 5],
                "str": []
            })
コード例 #2
0
coloredlogs.install(level="DEBUG")

Config.define_str(
    "model_path", "/opt/model/frozen_inference_graph.pb",
    "Path of the model to load and execute, for instance"
    "/opt/model/frozen_inference_graph.pb. If you're using docker-compose you shouldn't change this."
)
Config.define_str("input_dir", "",
                  "Path where the images to annotate are stored")
Config.define_str(
    "output_dir", "",
    "Path to store pre-annotations (model annotations to help human annotators)"
)
with Config.namespace("class"):
    Config.define_str_list("names", [], "name of the classes to annotate")
with Config.namespace("object_detection"):
    Config.define_float("threshold", 0.2,
                        "Discard boxes with score below this value")
    Config.define_float(
        "max_width", 1.0,
        "Discard boxes with width upper this value because in some cases, very large detections are mostly false positives"
    )


def main():
    Config.load_conf()
    config = Config.get_dict()
    assert config["model_path"] != "", "model_path can't be empty"
    assert config["input_dir"] != "", "input_dir can't be empty"
    assert config["output_dir"] != "", "output_dir can't be empty"
コード例 #3
0
from flask_cors import CORS

import flask

from distribute_config import Config

coloredlogs.install(level='DEBUG')

Config.define_str("images_path", "static/images",
                  "Path where are stored the images to annotate")
Config.define_str("human_annotations_path", "static/human_annotations",
                  "Path where are stored human annotation")
Config.define_str("model_annotations_path", "static/model_annotations",
                  "Path where are stored model annotation for helping human")
with Config.namespace("class"):
    Config.define_str_list("names", [], "name of the classes to annotate")
    Config.define_str_list("colors", [], "colors for each classes")
Config.define_int("min_height", 0,
                  "Rectangle with lower height will be displayed red")
Config.define_int("min_width", 0,
                  "Rectangle with lower width will be displayed red")

image_provider = None


class ImageProvider:
    def __init__(self):
        """class providing path of images to process
        """
        # user-provided attributes
        self.images_path = Config.get_var("images_path")