kopia lustrzana https://github.com/OpenDroneMap/WebODM
Update GeoDeep, more object detection classes
rodzic
85c56df2e7
commit
18e34830df
|
@ -6,7 +6,7 @@ from app.plugins.views import TaskView, GetTaskResult, TaskResultOutputError
|
||||||
from app.plugins.worker import run_function_async
|
from app.plugins.worker import run_function_async
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
def detect(orthophoto, model, progress_callback=None):
|
def detect(orthophoto, model, classes=None, progress_callback=None):
|
||||||
import os
|
import os
|
||||||
from webodm import settings
|
from webodm import settings
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ def detect(orthophoto, model, progress_callback=None):
|
||||||
return {'error': "GeoDeep library is missing"}
|
return {'error': "GeoDeep library is missing"}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return {'output': gdetect(orthophoto, model, output_type='geojson', max_threads=settings.WORKERS_MAX_THREADS, progress_callback=progress_callback)}
|
return {'output': gdetect(orthophoto, model, output_type='geojson', classes=classes, max_threads=settings.WORKERS_MAX_THREADS, progress_callback=progress_callback)}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {'error': str(e)}
|
return {'error': str(e)}
|
||||||
|
|
||||||
|
@ -31,10 +31,20 @@ class TaskObjDetect(TaskView):
|
||||||
orthophoto = os.path.abspath(task.get_asset_download_path("orthophoto.tif"))
|
orthophoto = os.path.abspath(task.get_asset_download_path("orthophoto.tif"))
|
||||||
model = request.data.get('model', 'cars')
|
model = request.data.get('model', 'cars')
|
||||||
|
|
||||||
if not model in ['cars', 'trees']:
|
# model --> (modelID, classes)
|
||||||
|
model_map = {
|
||||||
|
'cars': ('cars', None),
|
||||||
|
'trees': ('trees', None),
|
||||||
|
'athletic': ('aerovision', ['tennis-court', 'track-field', 'soccer-field', 'baseball-field', 'swimming-pool', 'basketball-court']),
|
||||||
|
'boats': ('aerovision', ['boat']),
|
||||||
|
'planes': ('aerovision', ['plane']),
|
||||||
|
}
|
||||||
|
|
||||||
|
if not model in model_map:
|
||||||
return Response({'error': 'Invalid model'}, status=status.HTTP_200_OK)
|
return Response({'error': 'Invalid model'}, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
celery_task_id = run_function_async(detect, orthophoto, model, with_progress=True).task_id
|
model_id, classes = model_map[model]
|
||||||
|
celery_task_id = run_function_async(detect, orthophoto, model_id, classes, with_progress=True).task_id
|
||||||
|
|
||||||
return Response({'celery_task_id': celery_task_id}, status=status.HTTP_200_OK)
|
return Response({'celery_task_id': celery_task_id}, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,9 @@ export default class ObjDetectPanel extends React.Component {
|
||||||
const models = [
|
const models = [
|
||||||
{label: _('Cars'), value: 'cars'},
|
{label: _('Cars'), value: 'cars'},
|
||||||
{label: _('Trees'), value: 'trees'},
|
{label: _('Trees'), value: 'trees'},
|
||||||
|
{label: _('Athletic Facilities'), value: 'athletic'},
|
||||||
|
{label: _('Boats'), value: 'boats'},
|
||||||
|
{label: _('Planes'), value: 'planes'}
|
||||||
]
|
]
|
||||||
|
|
||||||
let content = "";
|
let content = "";
|
||||||
|
|
|
@ -21,7 +21,7 @@ drf-nested-routers==0.11.1
|
||||||
funcsigs==1.0.2
|
funcsigs==1.0.2
|
||||||
futures==3.1.1
|
futures==3.1.1
|
||||||
gunicorn==19.8.0
|
gunicorn==19.8.0
|
||||||
geodeep==0.9.7
|
geodeep==0.9.8
|
||||||
itypes==1.1.0
|
itypes==1.1.0
|
||||||
kombu==4.6.7
|
kombu==4.6.7
|
||||||
Markdown==3.3.4
|
Markdown==3.3.4
|
||||||
|
|
Ładowanie…
Reference in New Issue