Esempio n. 1
0
 def test_define_float(self):
     Config.clear()
     Config.define_float("a", 5, "A test for float")
     Config.define_float("b", 5., "A test for float with a float var")
     Config.define_float("c", 5.6, "A test for float with a float var")
     Config.define_float("d", "5.6", "A test for float with a str var")
     with self.assertRaises(ValueError):
         Config.define_float("e", "bob",
                             "A test for float with a unparsable str")
     self.assertDictEqual(Config.get_dict(), {
         'a': 5.0,
         'b': 5.0,
         'c': 5.6,
         'd': 5.6
     })
Esempio n. 2
0
import cv2
import logging
import os
import coloredlogs
from distribute_config import Config

coloredlogs.install(level="DEBUG")

Config.define_str("file", "", "input file: video to read and split")
Config.define_float("extract_every", 100,
                    "Time in ms between two extracted images")
Config.define_str("prefix", "", "Prefix to the name of the images")
Config.define_str("outputdir", ".", "Where to save the pictures")


def main():
    Config.load_conf("config_video_burst.yml")
    config = Config.get_dict()

    # check if the script can run
    assert os.path.isfile(config["file"]), f"Option 'file' need to be provided"
    os.makedirs(config["outputdir"], exist_ok=True)

    if (config["prefix"] is ""):
        config["prefix"] = get_prefix(config["file"])
        logging.info(f'prefix: {config["prefix"]}')

    frame_id = 0
    last_save = -10000
    video = cv2.VideoCapture(config["file"])
    if not video.isOpened():
Esempio n. 3
0
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"

    os.makedirs(config["output_dir"], exist_ok=True)
    images_list = os.listdir(config["input_dir"])