import numpy as np import torch import gradio as gr from infer import detections import os os.system("mkdir data") os.system("mkdir data/models") ''' os.system("wget https://www.cs.cmu.edu/~walt/models/walt_people.pth -O data/models/walt_people.pth") ''' os.system("wget https://www.cs.cmu.edu/~walt/models/walt_vehicle.pth -O data/models/walt_vehicle.pth") def walt_demo(input_img, confidence_threshold): #detect_people = detections('configs/walt/walt_people.py', 'cuda:0', model_path='data/models/walt_people.pth') if torch.cuda.is_available() == False: device='cpu' else: device='cuda:0' #detect_people = detections('configs/walt/walt_people.py', device, model_path='data/models/walt_people.pth') detect = detections('configs/walt/walt_vehicle.py', device, model_path='data/models/walt_vehicle.pth', threshold=confidence_threshold) count = 0 #img = detect_people.run_on_image(input_img) output_img = detect.run_on_image(input_img) #try: #except: # print("detecting on image failed") return output_img description = """ WALT Demo on WALT dataset. After watching and automatically learning for several days, this approach shows significant performance improvement in detecting and segmenting occluded people and vehicles, over human-supervised amodal approaches.