Spaces:
Sleeping
Sleeping
Update doors_fasterrcnn.py
Browse files- doors_fasterrcnn.py +15 -10
doors_fasterrcnn.py
CHANGED
|
@@ -199,17 +199,22 @@ def main_run(pdf_fullpath, weights_path, pdf_name,pdfpath,ratio): ####pdf_fullpa
|
|
| 199 |
doors_count = {'Type': ['Single Doors', 'Double Doors'], 'Quantity': [len(sbox), len(dbox)]}
|
| 200 |
df_doors = pd.DataFrame(doors_count)
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
-
#Annotations that will be printed on the pdf
|
| 207 |
-
single_annotations = create_annotations("single door", single_info)
|
| 208 |
-
double_annotations = create_annotations("double door", double_info)
|
| 209 |
-
|
| 210 |
-
# add_annotations_to_pdf(new_image, pdf_name, single_annotations, double_annotations)
|
| 211 |
-
pdf_document=add_annotations_to_pdf(img_pillow, pdf_name, single_annotations, double_annotations)
|
| 212 |
-
|
| 213 |
page=pdf_document[0]
|
| 214 |
pix = page.get_pixmap() # render page to an image
|
| 215 |
pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|
|
|
|
| 199 |
doors_count = {'Type': ['Single Doors', 'Double Doors'], 'Quantity': [len(sbox), len(dbox)]}
|
| 200 |
df_doors = pd.DataFrame(doors_count)
|
| 201 |
|
| 202 |
+
single_midpoint = mid_points_bbox(sbox)
|
| 203 |
+
double_midpoint = mid_points_bbox(dbox)
|
| 204 |
+
|
| 205 |
+
#Kind Annotations
|
| 206 |
+
single_annotations = create_annotations("single door", single_midpoint)
|
| 207 |
+
double_annotations = create_annotations("double door", double_midpoint)
|
| 208 |
+
#Lines Annotations
|
| 209 |
+
line_single, width_signle = width_annotations(sbox, 1)
|
| 210 |
+
line_double, width_double = width_annotations(dbox, 1)
|
| 211 |
+
#Width Annotations
|
| 212 |
+
width_single_ann = create_width_annotations(width_signle)
|
| 213 |
+
width_double_ann = create_width_annotations(width_double)
|
| 214 |
+
|
| 215 |
+
# add_annotations_to_pdf(new_image, pdf_name, single_annotations, double_annotations)
|
| 216 |
+
add_annotations_to_pdf(img_pillow, pdf_name, single_annotations, double_annotations,width_single_ann,width_double_ann,line_single,line_double)
|
| 217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
page=pdf_document[0]
|
| 219 |
pix = page.get_pixmap() # render page to an image
|
| 220 |
pl=Image.frombytes('RGB', [pix.width,pix.height],pix.samples)
|