Show HN: VisionScript, abstract programming language for computer vision (github.com)
This weekend, I recorded a demo for VisionScript, in which I made apps that count how many cats are in an image and hides people in a video. Each app was < 10 lines of code.
VisionScript is built for the 10 year old inside of me who would have loved more visual programming languages with which to play. I want to show people the potential of programming and how you can make what you want with computers, whether it be a game that counts cats or an app that monitors how many birds flew past a tree. Those "wow" moments should come as soon as possible in one's learning experience.
VisionScript is in active development. I started work on this project in July. There will likely be bugs; this is a passion project. Inspiration comes from Wolfram and Python. Behind the scenes, I am adopting what I am calling "lexical inference", which is to say there is a last state value on which functions infer; the language manages types and state.
22 comments
[ 3.8 ms ] story [ 53.4 ms ] threadAnd can you iterate over multiple objects with the same label, e.g. if you want to replace all faces by emoji?
On a separate note, one idea I had was to have rock paper scissors as a quickstart. You could Use["rock paper scissors"] to use that as a model; there could perhaps be a registry of curated, fun models that people can play with out of the box (aka ones good for classroom use).
Example script:
This method is more advanced than most. It uses CLIP behind the scenes to detect when classifications change for more than N frames in a video, and generates a list of timestamps you can use to determine scene changes.I'm keen to build more specific functions for common CV tasks. My code most certainly needs cleaned (the main lang.py is > 2k LOCs right now) but I do have a contributing guide that you can follow to add features should you be interested: https://github.com/capjamesg/visionscript/blob/main/CONTRIBU...
Scratch does have an "Extensions" feature, so perhaps it would be possible (https://github.com/scratchfoundation/scratch-vm/blob/develop...)!
I have been thinking about learning progressions with a language like VisionScript. I see a notebook-like environment being a great place to start; dragging and dropping is intuitive (and fun!).
But if that notebook can introduce someone to the same primitives they can use in a text-based programming language? That gives you the ability to help someone graduate to a full programming environment.
Notebook -> Text that uses the same syntax as the notebook (you could drag+drop in the notebook then write out the text as a starting point!) -> Writing your own programs.
A friend suggested that the implicit state approach of VisionScript could be used in other areas too like audio. I reasoned that we could actually use many of the same primitive names and syntax; just a different backend. I don't know enough about audio processing, but the idea is fascinating!
To classify images, you can use Classify["class 1", "class 2", ...]; to run object detection you can use Detect["object"]; to run segmentation, use Segment["class"]. More abstract methods include Search[], that lets you build a semantic search engine in a few lines of code:
I am aiming to encode best practices from computer vision behind the scenes (I work in the industry) to enable one to build powerful applications intuitively, with few lines of code!That's great, but I have to agree with chpatrick that this seems like a cool library but it is unlikely to get used as a stand alone language.
New languages cut off a huge amount of utility. Decades of IO, libraries, tools, built in features, gc refinement etc. go out of the window. I'm not sure what the advantage is. If it is a simple standalone library that has advantages over other things out there it stands a lot more chance of being used.
> it may be more intuitive for a beginner
It keeps things simple, true, but the conceptual leap is bigger when it no longer suffices. But that's a bit of a luxury problem.
I'll be keeping an eye out on your repo.
There's several segmentation models listed there, do you plan to support "Segment Anything" at some point? I remember reading it was a pretty good model... but I'm not an expert