Pip3 install videoflow – new Python library to do computer vision on video
github.com
github.com
I couldnt find an easy way to fetch pretrained models (from where? which one?), feed the webcam stream, and then do inference "is there a face in the image?".
It would probably be trivial for someone who knows CV libraries or tensorflow, but we really miss the good old time when 5 obvious lines of Python did the job.
Maybe a new Python standard library with an API for AI would be useful here.
I was thinking about a new high-level module in the standard, you would just (pseudo python code) :
import ai.vision
guesses = ai.vision.guess(open('myimage.png'))
print(guesses)
# ["cat","person","boat"]
Three lines, everything else is abstracted. You would have ai.vision and ai.text for a start, with some accessors to other state-of-the-art models (like ai.vision.imagenet if you know better what your are doing)The underlying models would be shipped and updated with newer versions of Python.
$ pip install pymodel-ResNet-1337
#! /usr/bin/env python3
import ai
model = ai.loadModel("ResNet-1337",input=ai.input.Image,output=ai.output.Category)
model.guess(open('myimage.png'))
Problems abound, for example, how would you resample/rescale the image.I'd want, to start, a standard model format that can be serialized/deserialized into any language that can be (for example) pip installed and loaded. People seem to use HD5 but I don't think there is any sort of "standard".
So I'd expect the first incarnations of this idea to look like this:
$ pip install tfmodel-ResNet-1377
or $ pip install kerasmodel-ResNet-1337
With some hooks for loading models: #!/usr/bin/env python3
# whereas before you'd build a network, train it, and then use it, here you get the whole shebang in one go
model = keras.loadInstalledModel("ResNet-1337")
Rest of it is up to the user, as usualNeedless to say, I strongly suspect very few researchers have enough dev chops to meaningfully use Gstreamer. When it does work, though, it's pretty great, and it offers reasonable integration with GTK and can be made to work with Cairo. I got it to the point where it works for what I need to do, but I wouldn't want to release the code on GitHub because it's relatively high maintenance.
Interestingly I ended up with a similar layout: a set of frame producers (video file, webcam, sequence of jpegs), 2 video sinks (gtk and mp4), and the code to draw stuff in between (using PyCairo for vector and PIL for raster).
The sheer existence of this helps. You don't pay for hosting.