amlpai04 commited on
Commit
198f8ab
·
1 Parent(s): 0bfc111

forgot assets catalog

Browse files
Files changed (2) hide show
  1. .gitignore +1 -2
  2. app/tabs/visualizer.py +9 -3
.gitignore CHANGED
@@ -41,5 +41,4 @@ data/
41
  mlruns/
42
 
43
  #models
44
- models--Riksarkivet--HTR_pipeline_models/
45
- app/assets/images/*.jpg
 
41
  mlruns/
42
 
43
  #models
44
+ models--Riksarkivet--HTR_pipeline_models/
 
app/tabs/visualizer.py CHANGED
@@ -42,15 +42,21 @@ def load_visualize_state_from_submit(col: Collection, progress):
42
  if not seg:
43
  continue
44
 
45
- cropped_line_img = imgproc.crop(page_image, seg.bbox)
 
 
 
 
 
46
  cropped_line_img = np.clip(cropped_line_img, 0, 255).astype(np.uint8)
47
  line_crops.append(cropped_line_img)
48
 
49
- if seg.polygon is not None:
50
- line_polygons.append(seg.polygon)
51
 
52
  annotated_image = draw_polygons(page_image, line_polygons)
53
  annotated_page_node = np.clip(annotated_image, 0, 255).astype(np.uint8)
 
54
  results.append(
55
  {
56
  "page_image": page_node,
 
42
  if not seg:
43
  continue
44
 
45
+ polygon = (
46
+ seg.polygon.move(page_node.coord) if page_node.coord else seg.polygon
47
+ )
48
+ bbox = seg.bbox.move(page_node.coord) if page_node.coord else seg.bbox
49
+
50
+ cropped_line_img = imgproc.crop(page_image, bbox)
51
  cropped_line_img = np.clip(cropped_line_img, 0, 255).astype(np.uint8)
52
  line_crops.append(cropped_line_img)
53
 
54
+ if polygon is not None:
55
+ line_polygons.append(polygon)
56
 
57
  annotated_image = draw_polygons(page_image, line_polygons)
58
  annotated_page_node = np.clip(annotated_image, 0, 255).astype(np.uint8)
59
+
60
  results.append(
61
  {
62
  "page_image": page_node,