Skip to content

Commit 18e3483

Browse files
committed
Update GeoDeep, more object detection classes
1 parent 85c56df commit 18e3483

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

coreplugins/objdetect/api.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from app.plugins.worker import run_function_async
77
from django.utils.translation import gettext_lazy as _
88

9-
def detect(orthophoto, model, progress_callback=None):
9+
def detect(orthophoto, model, classes=None, progress_callback=None):
1010
import os
1111
from webodm import settings
1212

@@ -17,7 +17,7 @@ def detect(orthophoto, model, progress_callback=None):
1717
return {'error': "GeoDeep library is missing"}
1818

1919
try:
20-
return {'output': gdetect(orthophoto, model, output_type='geojson', max_threads=settings.WORKERS_MAX_THREADS, progress_callback=progress_callback)}
20+
return {'output': gdetect(orthophoto, model, output_type='geojson', classes=classes, max_threads=settings.WORKERS_MAX_THREADS, progress_callback=progress_callback)}
2121
except Exception as e:
2222
return {'error': str(e)}
2323

@@ -31,10 +31,20 @@ def post(self, request, pk=None):
3131
orthophoto = os.path.abspath(task.get_asset_download_path("orthophoto.tif"))
3232
model = request.data.get('model', 'cars')
3333

34-
if not model in ['cars', 'trees']:
34+
# model --> (modelID, classes)
35+
model_map = {
36+
'cars': ('cars', None),
37+
'trees': ('trees', None),
38+
'athletic': ('aerovision', ['tennis-court', 'track-field', 'soccer-field', 'baseball-field', 'swimming-pool', 'basketball-court']),
39+
'boats': ('aerovision', ['boat']),
40+
'planes': ('aerovision', ['plane']),
41+
}
42+
43+
if not model in model_map:
3544
return Response({'error': 'Invalid model'}, status=status.HTTP_200_OK)
3645

37-
celery_task_id = run_function_async(detect, orthophoto, model, with_progress=True).task_id
46+
model_id, classes = model_map[model]
47+
celery_task_id = run_function_async(detect, orthophoto, model_id, classes, with_progress=True).task_id
3848

3949
return Response({'celery_task_id': celery_task_id}, status=status.HTTP_200_OK)
4050

coreplugins/objdetect/public/ObjDetectPanel.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,10 @@ export default class ObjDetectPanel extends React.Component {
175175
const { loading, permanentError, objLayer, detecting, model, progress } = this.state;
176176
const models = [
177177
{label: _('Cars'), value: 'cars'},
178-
{label: _('Trees'), value: 'trees'},
178+
{label: _('Trees'), value: 'trees'},
179+
{label: _('Athletic Facilities'), value: 'athletic'},
180+
{label: _('Boats'), value: 'boats'},
181+
{label: _('Planes'), value: 'planes'}
179182
]
180183

181184
let content = "";

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ drf-nested-routers==0.11.1
2121
funcsigs==1.0.2
2222
futures==3.1.1
2323
gunicorn==19.8.0
24-
geodeep==0.9.7
24+
geodeep==0.9.8
2525
itypes==1.1.0
2626
kombu==4.6.7
2727
Markdown==3.3.4

0 commit comments

Comments
 (0)