151 points · by jadielam · 7y ago · 16 comments
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.
Needless 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.