Spaces:
Runtime error
Runtime error
import cv2 | |
from pipline_functions import croped_images,object_detection,image_enhancements,detect_activity,get_distances,get_json_data | |
import os | |
def pipline(image): | |
"""_summary_ | |
Args: | |
image (numpy array): get numpy array of image which has 3 channels | |
Returns: | |
final_results: JSON Array which has below object | |
{ | |
'zoomed_img':np.array([]) , | |
'actual_boxes':[], | |
'updated_boxes':{}, | |
} | |
""" | |
# detect object of given image using YOLO and get json_data of each object | |
json_data = object_detection(image) | |
# get croped_images list which has overlapping boundry box and also get croped single object images | |
croped_images_list,single_object_images= croped_images(image,json_data) | |
# enhance images of both croped images and single object images | |
enhanced_images,single_object_images = image_enhancements(croped_images_list,single_object_images) | |
# detect activity of person object using image classification | |
detected_activity = detect_activity(single_object_images) | |
# Calculate distances of all objects | |
distances_list = get_distances(json_data) | |
# get final json array | |
final_results = get_json_data(json_data,enhanced_images,detected_activity,distances_list) | |
# print(distances_list) | |
# print(detected_activity) | |
# print(final_results) | |
return final_results | |
pipline(cv2.imread('distance_test\distance_test\images\car_99-94168281555176_Mon-Dec-13-16-37-40-2021_jpg.rf.a8c56aba60dd3a19f2c2f159a2c9062d.jpg')) |