Skip to content

Commit 52901b0

Browse files
committed
wip
1 parent 1275eb7 commit 52901b0

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

integration_tests/client/models/test_model.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ def test_create_image_model_with_predicted_detections(
192192
assert fx_points in db_point_lists
193193

194194

195+
def _convert_bitstring_to_numpy(bitmask: models.Bitmask):
196+
return np.array([bit == "1" for bit in bitmask.value]).reshape(
197+
(bitmask.height, bitmask.width)
198+
)
199+
200+
195201
def test_create_model_with_predicted_segmentations(
196202
db: Session,
197203
client: Client,
@@ -217,17 +223,21 @@ def test_create_model_with_predicted_segmentations(
217223
# grab the segmentation from the db, recover the mask, and check
218224
# its equal to the mask the client sent over
219225
db_annotations = (
220-
db.query(models.Annotation)
226+
db.query(models.Bitmask)
227+
.join(
228+
models.Annotation,
229+
models.Annotation.bitmask_id == models.Bitmask.id,
230+
)
221231
.where(models.Annotation.model_id.isnot(None))
222232
.all()
223233
)
224234

225235
if db_annotations[0].datum_id < db_annotations[1].datum_id:
226-
raster_uid1 = db_annotations[0].raster
227-
raster_uid2 = db_annotations[1].raster
236+
raster_uid1 = _convert_bitstring_to_numpy(db_annotations[0])
237+
raster_uid2 = _convert_bitstring_to_numpy(db_annotations[1])
228238
else:
229-
raster_uid1 = db_annotations[1].raster
230-
raster_uid2 = db_annotations[0].raster
239+
raster_uid1 = _convert_bitstring_to_numpy(db_annotations[1])
240+
raster_uid2 = _convert_bitstring_to_numpy(db_annotations[0])
231241

232242
# test raster 1
233243
png_from_db = db.scalar(ST_AsPNG(raster_uid1))

0 commit comments

Comments
 (0)