Skip to content

Commit f1c3d9a

Browse files
author
Matt Sokoloff
committed
fix function names
1 parent 38c38bb commit f1c3d9a

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

examples/model_assisted_labeling/image_mal.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
{
1212
"cell_type": "code",
13-
"execution_count": 2,
13+
"execution_count": 1,
1414
"id": "committed-richards",
1515
"metadata": {},
1616
"outputs": [],
@@ -31,10 +31,10 @@
3131
"import ndjson\n",
3232
"from image_model import predict, class_mappings, load_model\n",
3333
"from image_mal_utils import (\n",
34-
" visualize_bbox_upload,\n",
35-
" visualize_poly_upload,\n",
36-
" visualize_point_upload,\n",
37-
" visualize_mask_uploads\n",
34+
" visualize_bbox_ndjsons,\n",
35+
" visualize_poly_ndjsons,\n",
36+
" visualize_point_ndjsons,\n",
37+
" visualize_mask_ndjsons\n",
3838
")"
3939
]
4040
},
@@ -319,10 +319,10 @@
319319
],
320320
"source": [
321321
"image = np.array(Image.open(BytesIO(np_image_bytes[0])))\n",
322-
"image = visualize_bbox_upload(image,nd_box_payloads ,(0,255,0))\n",
323-
"image = visualize_poly_upload(image,nd_poly_payloads ,(0,0,255))\n",
324-
"image = visualize_point_upload(image,nd_point_payloads ,(0,255,255))\n",
325-
"image = visualize_mask_uploads(image, nd_mask_payloads)\n",
322+
"image = visualize_bbox_ndjsons(image,nd_box_payloads ,(0,255,0))\n",
323+
"image = visualize_poly_ndjsons(image,nd_poly_payloads ,(0,0,255))\n",
324+
"image = visualize_point_ndjsons(image,nd_point_payloads ,(0,255,255))\n",
325+
"image = visualize_mask_ndjsons(image, nd_mask_payloads)\n",
326326
"Image.fromarray(image)"
327327
]
328328
},

examples/model_assisted_labeling/image_mal_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@
44
from io import BytesIO
55
from PIL import Image
66

7-
def visualize_bbox_upload(image, bbox_ndjsons, color):
7+
def visualize_bbox_ndjsons(image, bbox_ndjsons, color):
88
for bbox_ndjson in bbox_ndjsons:
99
bbox = bbox_ndjson['bbox']
1010
start_point = (int(bbox['left']), int(bbox['top']))
1111
end_point = (int(bbox['left'] + bbox['width']), int(bbox['top'] + bbox['height']))
1212
image = cv2.rectangle(image, start_point, end_point, thickness = 2, color = color)
1313
return image
1414

15-
def visualize_poly_upload(image, poly_ndjsons, color):
15+
def visualize_poly_ndjsons(image, poly_ndjsons, color):
1616
for poly_ndjson in poly_ndjsons:
1717
pts = [[poly['x'], poly['y']] for poly in poly_ndjson['polygon']]
1818
pts = np.array(pts).astype(np.int32)
1919
image = cv2.polylines(image,[pts],True,color, thickness = 2)
2020
return image
2121

22-
def visualize_point_upload(image, point_ndjsons, color):
22+
def visualize_point_ndjsons(image, point_ndjsons, color):
2323
for point_ndjson in point_ndjsons:
2424
point = point_ndjson['point']
2525
image = cv2.circle(image, (point['x'],point['y']), radius=10, color=color, thickness=-1)
2626
return image
2727

28-
def visualize_mask_uploads(image, mask_ndjsons):
28+
def visualize_mask_ndjsons(image, mask_ndjsons):
2929
masks = []
3030
for ndjson in mask_ndjsons:
3131
instanceURI = ndjson['mask']['instanceURI']

0 commit comments

Comments
 (0)