def temp_import_detector(path="/Users/aub3/tempd"): """ For testing pre-developed detectors :param path: :return: """ setup_django() from dvaapp.shared import create_detector_folders import json from django.conf import settings from dvaapp.models import CustomDetector d = CustomDetector() with open("{}/input.json".format(path)) as infile: data = json.load(infile) d.name = "test detector" d.class_names = json.dumps(data['class_names']) d.phase_1_log = file("{}/phase_1.log".format(path)).read d.phase_2_log = file("{}/phase_2.log".format(path)).read d.frames_count = 500 d.boxes_count = 500 d.class_distribution = json.dumps(data['class_names']) d.save() create_detector_folders(d) shutil.copy("{}/phase_2_best.h5".format(path),"{}/detectors/{}/phase_2_best.h5".format(settings.MEDIA_ROOT,d.pk))
def test_train_yolo(): """ :return: """ setup_django() from dvaapp.models import TEvent, CustomDetector from dvaapp.tasks import train_yolo_detector from django.conf import settings args = {} detector = CustomDetector() detector.save() args['detector_pk'] = detector.pk args['object_names'] = [ "red_buoy", "green_buoy", "yellow_buoy", "path_marker", "start_gate", "channel" ] args['root_dir'] = "{}/models/{}/".format(settings.MEDIA_ROOT, detector.pk) train_yolo_detector( TEvent.objects.create(arguments_json=json.dumps(args)).pk)