Open haviduck opened 4 years ago
Sounds interesting :) Did you make any progress? I'm not quite sure what you're trying to do. Do you want to upload a video file or have the API process the video frame by frame (as individual images)?
yes! i have it working :) only draw back is that docker stack deploy doesnt support gpus yet. but docker compose with some tweaks works Great. i have it working both via your repo and tiangolos full postgres stack. it is lacking good api work with file upload etc, but that is trivial. ill be glad to share.
its doing frame by frame. i have 1 function for json and 1 for mjpeg
Good to hear. I unfortunately don't have time to try to implement something like that myself currently, so if you plan to make what you've done publicly available then I'd love to have a look at how you've done it :)
Good to hear. I unfortunately don't have time to try to implement something like that myself currently, so if you plan to make what you've done publicly available then I'd love to have a look at how you've done it :)
absolutely, Will ping once its published
heya! I got your repo working with videos, its amazing thanks for sharing your code. I found a different repo that included queueing, fastapi and workers. trying to combine your dockerized darknet with it as .so needs to be compiled, but im not that good with docker. wanna trade pokemon and see if we can do some good?
optimally i want to do a generator so the json stream can be grabbed continously, but this is atleast a start!
`def convertBack(x, y, w, h): xmin = int(round(x - (w / 2))) xmax = int(round(x + (w / 2))) ymin = int(round(y - (h / 2))) ymax = int(round(y + (h / 2))) return xmin, ymin, xmax, ymax
def cvDrawBoxes(detections, img): res="" for detection in detections: x, y, w, h = detection[2][0],\ detection[2][1],\ detection[2][2],\ detection[2][3] xmin, ymin, xmax, ymax = convertBack( float(x), float(y), float(w), float(h)) pt1 = (xmin, ymin) pt2 = (xmax, ymax)
netMain = None metaMain = None altNames = None
def YOLO(): global metaMain, netMain, altNames, curframe, hue, saturation, brightness, listcoords configPath = "./" weightPath = "./" metaPath = "./" if not os.path.exists(configPath): raise ValueError("Invalid config path
" + os.path.abspath(configPath) + "
") if not os.path.exists(weightPath): raise ValueError("Invalid weight path" + os.path.abspath(weightPath) + "
") if not os.path.exists(metaPath): raise ValueError("Invalid data file path" + os.path.abspath(metaPath) + "
") if netMain is None: netMain = darknet.load_net_custom(configPath.encode( "ascii"), weightPath.encode("ascii"), 0, 1) # batch size = 1 if metaMain is None: metaMain = darknet.load_meta(metaPath.encode("ascii")) if altNames is None: try: with open(metaPath) as metaFH: metaContents = metaFH.read() import re match = re.search("names = (.*)$", metaContents, re.IGNORECASE | re.MULTILINE) if match: result = match.group(1) else: result = None try: if os.path.exists(result): with open(result) as namesFH: namesList = namesFH.read().strip().split("\n") altNames = [x.strip() for x in namesList] except TypeError: pass except Exception: pass`/yolo: post: operationId: app.YOLO summary: Perform object detection on uploaded video. consumes:
heres what i followed: https://github.com/GregaVrbancic/fastapi-celery