Spaces:
Runtime error
Runtime error
Nadine Rueegg
commited on
Commit
β’
6cdca0e
1
Parent(s):
76ae6e9
adjust print statements and close figures
Browse files
gradio_demo/barc_demo_v6.py
CHANGED
@@ -21,6 +21,7 @@ import cv2
|
|
21 |
from matplotlib import pyplot as plt
|
22 |
from PIL import Image
|
23 |
import random
|
|
|
24 |
import gradio as gr
|
25 |
|
26 |
import sys
|
@@ -120,6 +121,7 @@ def run_bbox_inference(input_image):
|
|
120 |
img, bbox = detect_object(model=model_bbox, img_path_or_img=input_image, confidence=0.5)
|
121 |
fig = plt.figure() # plt.figure(figsize=(20,30))
|
122 |
plt.imsave(out_path, img)
|
|
|
123 |
return img, bbox
|
124 |
# -------------------------------------------------------------------------------------------------------------------- #
|
125 |
|
@@ -195,9 +197,11 @@ def run_barc_inference(input_image, bbox=None):
|
|
195 |
total_count = 0
|
196 |
|
197 |
def run_complete_inference(img_path_or_img, crop_choice):
|
|
|
|
|
198 |
global total_count
|
199 |
total_count += 1
|
200 |
-
print('total count: ' + str(total_count))
|
201 |
# depending on crop_choice: run faster r-cnn or take the input image directly
|
202 |
if crop_choice == "input image is cropped":
|
203 |
if isinstance(img_path_or_img, str):
|
|
|
21 |
from matplotlib import pyplot as plt
|
22 |
from PIL import Image
|
23 |
import random
|
24 |
+
from datetime import datetime
|
25 |
import gradio as gr
|
26 |
|
27 |
import sys
|
|
|
121 |
img, bbox = detect_object(model=model_bbox, img_path_or_img=input_image, confidence=0.5)
|
122 |
fig = plt.figure() # plt.figure(figsize=(20,30))
|
123 |
plt.imsave(out_path, img)
|
124 |
+
plt.close()
|
125 |
return img, bbox
|
126 |
# -------------------------------------------------------------------------------------------------------------------- #
|
127 |
|
|
|
197 |
total_count = 0
|
198 |
|
199 |
def run_complete_inference(img_path_or_img, crop_choice):
|
200 |
+
now = datetime.now()
|
201 |
+
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
|
202 |
global total_count
|
203 |
total_count += 1
|
204 |
+
print(dt_string + ' total count: ' + str(total_count))
|
205 |
# depending on crop_choice: run faster r-cnn or take the input image directly
|
206 |
if crop_choice == "input image is cropped":
|
207 |
if isinstance(img_path_or_img, str):
|
src/stacked_hourglass/datasets/imgcropslist.py
CHANGED
@@ -29,7 +29,7 @@ class ImgCrops(data.Dataset):
|
|
29 |
self.test_name_list = []
|
30 |
for ind in np.arange(0, len(self.image_list)):
|
31 |
self.test_name_list.append(str(ind))
|
32 |
-
print('len(dataset): ' + str(self.__len__()))
|
33 |
|
34 |
def __getitem__(self, index):
|
35 |
'''img_name = self.test_name_list[index]
|
|
|
29 |
self.test_name_list = []
|
30 |
for ind in np.arange(0, len(self.image_list)):
|
31 |
self.test_name_list.append(str(ind))
|
32 |
+
# print('len(dataset): ' + str(self.__len__()))
|
33 |
|
34 |
def __getitem__(self, index):
|
35 |
'''img_name = self.test_name_list[index]
|