|
|
|
|
@ -19,6 +19,7 @@ from cvat.apps.authentication.auth import has_admin_role
|
|
|
|
|
from cvat.apps.engine.serializers import LabeledDataSerializer
|
|
|
|
|
from cvat.apps.dataset_manager.task import put_task_data, patch_task_data
|
|
|
|
|
from cvat.apps.engine.frame_provider import FrameProvider
|
|
|
|
|
from cvat.apps.engine.utils import av_scan_paths
|
|
|
|
|
|
|
|
|
|
from .models import AnnotationModel, FrameworkChoice
|
|
|
|
|
from .model_loader import load_labelmap
|
|
|
|
|
@ -139,6 +140,7 @@ def create_or_update(dl_model_id, name, model_file, weights_file, labelmap_file,
|
|
|
|
|
tmp_file.write(chunk)
|
|
|
|
|
os.close(fd)
|
|
|
|
|
return filename
|
|
|
|
|
|
|
|
|
|
is_create_request = dl_model_id is None
|
|
|
|
|
if is_create_request:
|
|
|
|
|
dl_model_id = create_empty(owner=owner)
|
|
|
|
|
@ -155,6 +157,17 @@ def create_or_update(dl_model_id, name, model_file, weights_file, labelmap_file,
|
|
|
|
|
labelmap_file = save_file_as_tmp(labelmap_file)
|
|
|
|
|
interpretation_file = save_file_as_tmp(interpretation_file)
|
|
|
|
|
|
|
|
|
|
files_to_scan = []
|
|
|
|
|
if model_file:
|
|
|
|
|
files_to_scan.append(model_file)
|
|
|
|
|
if weights_file:
|
|
|
|
|
files_to_scan.append(weights_file)
|
|
|
|
|
if labelmap_file:
|
|
|
|
|
files_to_scan.append(labelmap_file)
|
|
|
|
|
if interpretation_file:
|
|
|
|
|
files_to_scan.append(interpretation_file)
|
|
|
|
|
av_scan_paths(*files_to_scan)
|
|
|
|
|
|
|
|
|
|
if owner:
|
|
|
|
|
restricted = not has_admin_role(owner)
|
|
|
|
|
else:
|
|
|
|
|
|