Spaces:
Sleeping
Sleeping
Update doors_fasterrcnn.py
Browse files- doors_fasterrcnn.py +8 -2
doors_fasterrcnn.py
CHANGED
|
@@ -100,6 +100,7 @@ def get_door_info(doors_info):
|
|
| 100 |
lines = []
|
| 101 |
sanda = []
|
| 102 |
line_midpoint = []
|
|
|
|
| 103 |
for door_inf in doors_info:
|
| 104 |
xmin, ymin, xmax, ymax = door_inf[0]
|
| 105 |
#horz_bottom
|
|
@@ -117,6 +118,7 @@ def get_door_info(doors_info):
|
|
| 117 |
#for calculation
|
| 118 |
width = distance((xmin,ymax), (xmax,ymax))
|
| 119 |
width_pixels.append(width)
|
|
|
|
| 120 |
|
| 121 |
#horz_upper
|
| 122 |
if door_inf[1] == 3:
|
|
@@ -245,7 +247,11 @@ def main_run(pdf_fullpath, weights_path, pdf_name,pdfpath,ratio): ####pdf_fullpa
|
|
| 245 |
char_width = width_as_char(real_width)
|
| 246 |
|
| 247 |
pdf_document = add_annotations_to_pdf(img_pillow, plan, lines, sanda, char_width, line_midpoint)
|
| 248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
|
| 250 |
page=pdf_document[0]
|
| 251 |
pix = page.get_pixmap() # render page to an image
|
|
@@ -262,7 +268,7 @@ def main_run(pdf_fullpath, weights_path, pdf_name,pdfpath,ratio): ####pdf_fullpa
|
|
| 262 |
|
| 263 |
|
| 264 |
# modify this return
|
| 265 |
-
return annotatedimg, pdf_document , spreadsheet_url, list1
|
| 266 |
|
| 267 |
# model_path = '/content/drive/MyDrive/combined.pth'
|
| 268 |
# #pdf_name = data
|
|
|
|
| 100 |
lines = []
|
| 101 |
sanda = []
|
| 102 |
line_midpoint = []
|
| 103 |
+
single_door = 0
|
| 104 |
for door_inf in doors_info:
|
| 105 |
xmin, ymin, xmax, ymax = door_inf[0]
|
| 106 |
#horz_bottom
|
|
|
|
| 118 |
#for calculation
|
| 119 |
width = distance((xmin,ymax), (xmax,ymax))
|
| 120 |
width_pixels.append(width)
|
| 121 |
+
#single_door +=1
|
| 122 |
|
| 123 |
#horz_upper
|
| 124 |
if door_inf[1] == 3:
|
|
|
|
| 247 |
char_width = width_as_char(real_width)
|
| 248 |
|
| 249 |
pdf_document = add_annotations_to_pdf(img_pillow, plan, lines, sanda, char_width, line_midpoint)
|
| 250 |
+
|
| 251 |
+
#Dataframe for Doors count
|
| 252 |
+
#doors_count = {'Type': ['Single Doors', 'Double Doors'], 'Quantity': [len(sbox), len(dbox)]}
|
| 253 |
+
doors_count = {'Type': ['Single Doors'], 'Quantity': [len(real_width)]}
|
| 254 |
+
df_doors = pd.DataFrame(doors_count)
|
| 255 |
|
| 256 |
page=pdf_document[0]
|
| 257 |
pix = page.get_pixmap() # render page to an image
|
|
|
|
| 268 |
|
| 269 |
|
| 270 |
# modify this return
|
| 271 |
+
return annotatedimg, pdf_document , spreadsheet_url, list1, df_doors
|
| 272 |
|
| 273 |
# model_path = '/content/drive/MyDrive/combined.pth'
|
| 274 |
# #pdf_name = data
|