owlting / ai_basketball_games_video_editor Goto Github PK
View Code? Open in Web Editor NEWAI Basketball Games Video Editor is a program to get basketball highlight video by PyTorch YOLOv4 object detection
License: Apache License 2.0
AI Basketball Games Video Editor is a program to get basketball highlight video by PyTorch YOLOv4 object detection
License: Apache License 2.0
I am pleasure I file the 1st issue here. I am very intrested in this tool and I am newbee of pytorch.
Thanks for your effort. ^^
when I use your wonderful script, it works well. but for longger video, it would take much time...
cpu: i5 8500 3.00GHz
gpu: GTX1060 6GB
def detect(self, model, img, image_size):
model.eval()
IN_IMAGE_H, IN_IMAGE_W = image_size
sized = cv2.resize(img, (IN_IMAGE_W, IN_IMAGE_H))
sized = cv2.cvtColor(sized, cv2.COLOR_BGR2RGB)
t0 = time.time()
if type(sized) == np.ndarray and len(sized.shape) == 3: # cv2 image
sized = torch.from_numpy(sized.transpose(2, 0, 1)).float().div(255.0).unsqueeze(0)
elif type(sized) == np.ndarray and len(sized.shape) == 4:
sized = torch.from_numpy(sized.transpose(0, 3, 1, 2)).float().div(255.0)
else:
print("unknow image type")
exit(-1)
use_cuda = 1
if use_cuda:
sized = sized.cuda()
sized = torch.autograd.Variable(sized)
t1 = time.time()
with torch.no_grad():
output = model(sized)
t2 = time.time()
# print('-----------------------------------')
# print(' Preprocess : %f' % (t1 - t0))
# print(' Model Inference : %f' % (t2 - t1))
# print('-----------------------------------')
boxes = post_processing(img, 0.4, 0.6, output)
return boxes
model:
m = Darknet(cfg_path)
# m.print_network()
m.load_weights(weight_path)
print('Loading weights from %s... Done!' % (weight_path))
if use_cuda:
m.cuda()
self.num_classes = m.num_classes
self.class_names = load_class_names(namesfile_path)
self.engine = m
self.image_size = inference_size
when use inference_size: (1184, 1184), each frame will take 200+
ms in the following step:
with torch.no_grad():
output = model(sized)
and total vedio frame size is 36000+, that means total time cost would be > 3 hour
So, if the pytorch has this such bad performance ? do you know the reason. Thank you. ^^
The operation process is good, but the video result cannot be opened, and the player prompts that the file is damaged
Hi there, awesome work, what data did you use for training the torch model. Could you provide it? Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.