MCPcopy
hub / github.com/WebODM/WebODM / post

Method post

coreplugins/objdetect/api.py:54–78  ·  view source on GitHub ↗
(self, request, pk=None)

Source from the content-addressed store, hash-verified

52
53class TaskObjDetect(TaskView):
54 def post(self, request, pk=None):
55 task = self.get_and_check_task(request, pk)
56
57 if task.orthophoto_extent is None:
58 return Response({'error': _('No orthophoto is available.')})
59
60 orthophoto = os.path.abspath(task.get_asset_download_path("orthophoto.tif"))
61 model = request.data.get('model', 'cars')
62
63 # model --> (modelID, classes)
64 model_map = {
65 'cars': ('cars', None),
66 'trees': ('trees', None),
67 'athletic': ('aerovision', ['tennis-court', 'track-field', 'soccer-field', 'baseball-field', 'swimming-pool', 'basketball-court']),
68 'boats': ('aerovision', ['boat']),
69 'planes': ('aerovision', ['plane']),
70 }
71
72 if not model in model_map:
73 return Response({'error': 'Invalid model'}, status=status.HTTP_200_OK)
74
75 model_id, classes = model_map[model]
76 celery_task_id = run_function_async(detect, orthophoto, model_id, classes, task.crop.wkt if task.crop is not None else None, with_progress=True).task_id
77
78 return Response({'celery_task_id': celery_task_id}, status=status.HTTP_200_OK)
79
80class TaskObjDownload(GetTaskResult):
81 def handle_output(self, output, result, **kwargs):

Callers

nothing calls this directly

Calls 5

run_function_asyncFunction · 0.90
get_and_check_taskMethod · 0.80
_Function · 0.50
getMethod · 0.45

Tested by

no test coverage detected