add_model_resnet18 #31

Merged
brian merged 47 commits from add_model_resnet18 into main 2024-04-03 21:04:23 +02:00
Showing only changes of commit 75b57bd28f - Show all commits
+15 -12
View File
@@ -1,3 +1,4 @@
"""Definition of function to get visual communication from database."""
from __future__ import annotations
import logging
@@ -18,19 +19,21 @@ def get_visual_communication(
query['annotation'] = {'$ne': None}
else:
query['annotation'] = {'$eq': None}
data = collection.aggregate([
{
'$match': query, # find using filters
},
{
'$sample': {
'size': 1, # get one random
data = collection.aggregate(
pipeline=[
{
'$match': query, # find using filters
},
},
])
{
'$sample': {
'size': 1, # get one random
},
},
],
)
data_list = list(data) # read data from cursor object
if len(data_list) == 0:
logging.error('failed getting visual communication')
raise NoDocumentFoundException()
logging.info('finished')
return VisualCommunication.model_validate(data_list[0])
vis_com = VisualCommunication.model_validate(data_list[0])
logging.debug('finished')
return vis_com