• Stars
    star
    339
  • Rank 124,632 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 1 year ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A high-level programming language for using computer vision.

VisionScript logo

VisionScript

VisionScript is an abstract programming language for doing common computer vision tasks, fast.

VisionScript is built in Python, offering a simple syntax for running object detection, classification, and segmentation models. Read the documentation.

View the demo.

Get Started 🚀

First, install VisionScript:

pip install visionscript

You can then run VisionScript using:

visionscript

This will open a VisionScript REPL in which you can type commands.

Run a File 📁

To run a VisionScript file, use:

visionscript ./your_file.vic

Use VisionScript in a Notebook 📓

VisionScript offers an interactive web notebook through which you can run VisionScript code.

To use the notebook, run:

visionscript --notebook

This will open a notebook in your browser. Notebooks are ephermal. You will need to copy your code to a file to save it.

Quickstart 🚀

Find people in an image using object detection

Load["./photo.jpg"]
Detect["person"]
Say[]

Find people in all images in a folder using object detection

In["./images"]
    Detect["person"]
    Say[]

Replace people in a photo with an emoji

Load["./abbey.jpg"]
Size[]
Say[]
Detect["person"]
Replace["emoji.png"]
Save["./abbey2.jpg"]

Classify an image

Load["./photo.jpg"]
Classify["apple", "banana"]

Installation 👷

To install VisionScript, clone this repository and run pip install -r requirements.txt.

Then, make a file ending in .vic in which to write your VisionScript code.

When you have written your code, run:

visionscript ./your_file.vic

Run in debug mode

Running in debug mode shows the full Abstract Syntax Tree (AST) of your code.

visionscript ./your_file.vic --showtree=True

Debug mode is useful for debugging code while adding new features to the VisionScript language.

Inspiration 🌟

The inspiration behind this project was to build a simple way of doing one-off tasks.

Consider a scenario where you want to run zero-shot classification on a folder of images. With VisionScript, you can do this in three lines of code:

In["./images"]
    Classify["cat", "dog"]
    Say[]

VisionScript is not meant to be a full programming language for all vision tasks, rather an abstract way of doing common tasks.

VisionScript is ideal if you are new to concepts like "classify" and "segment" and want to explore what they do to an image.

Syntax

The syntax is inspired by both Python and the Wolfram Language. VisionScript is an interpreted language, run line-by-line like Python. Statements use the format:

Statement[argument1, argument2, ...]

This is the same format as the Wolfram Language.

Lexical Inference and Memory

An (I think!) unique feature in VisionScript compared to other languages is lexical inference.

You don't need to declare variables to store images, etc. Rather, you can let VisionScript do the work. Consider this example:

Load["./photo.jpg"]
Size[]
Say[]

Here, Size[] and Say[] do not have any arguments. Rather, they use the last input. Wolfram Alpha has a feature to get the last input using %. VisionScript uses the same concept, but with a twist.

Indeed, Size[] and Say[] don't accept any arguments.

Developer Setup 🛠

If you want to add new features or fix bugs in the VisionScript language, you will need to set up a developer environment.

To do so, clone the language repository:

git clone https://github.com/capjamesg/VisionScript

Then, install the required dependencies and VisionScript:

pip install -r requirements.txt
pip install -e .

Now, you can run VisionScript using:

visionscript

Supported Models 📚

VisionScript provides abstract wrappers around:

  • CLIP by OpenAI (Classification)
  • Ultralytics YOLOv8 (Object Detection Training, Segmentation Training)
  • FastSAM by CASIA-IVA-Lab. (Segmentation)
  • GroundedSAM (Object Detection, Segmentation)
  • BLIP (Caption Generation)
  • ViT (Classification Training)

License 📝

This project is licensed under an MIT license.

More Repositories

1

aurora

A fast, extensible static site generator implemented in Python. ✨
Python
163
star
2

knowledge-graph-language

A query language for exploring knowledge graphs.
Python
135
star
3

cv-book-svg

Turn an image of a bookshelf into an interactive SVG.
HTML
119
star
4

sam-gpt4v

Use Grounding DINO, Segment Anything, and GPT-4V to label images with segmentation masks for use in training smaller, fine-tuned models.
Python
64
star
5

bsky.link

Generate embeddable link previews to posts on Bluesky.
Nunjucks
27
star
6

sam-clip

Use Grounding DINO, Segment Anything, and CLIP to label objects in images.
Python
22
star
7

vinyl-record-indexing

A system for indexing vinyl records.
Python
22
star
8

indieweb-search

Source code for the IndieWeb search engine.
Python
22
star
9

indieweb-utils

Utilities to aid the implementation of various IndieWeb specifications and functionalities. Built with Python.
Python
21
star
10

open-shelves

An open source computer vision project to identify book spines.
Python
14
star
11

nanosearch

Build a search engine from a website sitemap.
Python
12
star
12

spreadsheet

A spreadsheet engine implemented in Python.
Python
12
star
13

webmemex.js

Display cards for all of the outgoing links on a web page.
JavaScript
11
star
14

cinnamon

A social reader built with Python Flask.
Python
10
star
15

webmention-receiver

A webmention receiver written in Python Flask with sqlite3.
Python
8
star
16

aurora-blog-template

A blog template made with the Aurora static site generator.
HTML
7
star
17

jamesql

An in-memory NoSQL database implemented in Python.
JavaScript
7
star
18

SEOtools

A set of utilities for SEOs and web developers with which to complete common tasks.
Python
6
star
19

build-a-search-index

Code to accompany the "Build a search index in Python" tutorial.
Python
6
star
20

pysurprisal

Calculate surprisal for words in text.
Python
5
star
21

google-indexing-api

Use the Google Indexing API to submit URLs for indexing to Google Search.
Python
5
star
22

papers-with-code-rss

Papers with Code RSS feeds.
Python
5
star
23

awesome-clip-projects

A list of projects that use OpenAI's CLIP model.
4
star
24

airport-pianos

Helping place more pianos in airports.
Nunjucks
4
star
25

avtr.dev

Retrieve an avatar for a URL.
Perl
4
star
26

interactive-image-svg

An experiment with an interactive image in a HTML document with SVG overlays.
HTML
4
star
27

jamesg-indieauth

An IndieAuth endpoint built with Python Flask.
Python
4
star
28

zero-shot-crack-detection

Zero-shot crack detection with SAM and Grounding DINO.
Python
4
star
29

awsnap.js

Navigate websites by clicking your fingers and saying the link you want to visit.
HTML
3
star
30

indieweb-etherpad-archiver

Perl tool for archiving Etherpad links to the IndieWeb wiki.
Perl
3
star
31

web-calendar

A web component for rendering static calendars.
JavaScript
3
star
32

llm-chatbot

A chatbot that references documents in a limited corpus to answer questions.
Python
3
star
33

adventures-with-compression

My adventures with compression.
Python
3
star
34

indieweb-search-links

Link analysis for IndieWeb Search
Python
3
star
35

micropub

A Micropub client and server implemented in Python Flask.
Python
3
star
36

web-reader

A minimal web reader.
Python
3
star
37

hugging-face-papers-rss

An RSS feed for Hugging Face Papers.
Python
3
star
38

autowrite-v2

A personal predictive text engine with a web client.
HTML
3
star
39

taytaylyricofthe.day

Challenge: Fill in the missing word of a Taylor Swift lyric every day.
HTML
3
star
40

autowrite

Context-aware autocomplete and autocorrect powered by word surprisals.
HTML
2
star
41

hovercard.js

A script to load cards when you hover over a link in an article.
JavaScript
2
star
42

drag-and-drop-list

A web component that lets you drag and drop items in a list to reorder items.
JavaScript
2
star
43

computer-vision-challenges

Test your knowledge of computer vision with these challenges.
2
star
44

html-timelines

Make a timeline with HTML.
HTML
2
star
45

linguist.link

Find the most surprising words and most common n-grams on a web page.
Python
2
star
46

salmention

Salmention playground.
HTML
2
star
47

openai-blog-rss

An RSS feed for the OpenAI blog.
Python
2
star
48

microsub-opml-utils

Import OPML files into a Microsub server and export Microsub subscriptions to an OPML file.
Ruby
2
star
49

guessthechar

Guess the missing character.
Python
2
star
50

seasonal.js

Change an emoji on your website for different seasonal events.
JavaScript
2
star
51

calendar-date

A web component to show calendar dates on your website.
JavaScript
2
star
52

spontaneity-rss

RSS Feed for @telepathics' Spontaneity Generator
JavaScript
2
star
53

website-trading-cards

Generate a trading card for your personal website.
HTML
2
star
54

image-map-maker

A tool to make image maps.
HTML
2
star
55

disinfo-domains

Check if a domain has been flagged as associated with disinformation on Wikipedia.
Python
2
star
56

random-boolean-networks

Experimentation with random boolean networks.
Python
2
star
57

pyatproto

A wrapper for interacting with the AT Protocol API.
Python
2
star
58

screenshots

A service to serve meta images for my personal website.
HTML
2
star
59

taylor-swift-acronyms

Analysis of Taylor Swift song name acronyms.
Python
1
star
60

stories.js

A HTML component that enables stories on your personal website.
HTML
1
star
61

awesome-grounding-dino

A curated list of tools using and applications of Grounding DINO.
1
star
62

pattern-matching

Find patterns in strings.
Python
1
star
63

visionscript-vscode-highlight

A TextMate Grammar (tmGrammar) for use with VisionScript.
JavaScript
1
star
64

visionscript-examples

Unofficial VisionScript examples with notes used for brainstorming language design.
1
star
65

wiki

A personal wiki for documenting projects. Authentication powered by IndieAuth.
Python
1
star
66

fine-tune-clip

Fine-tune CLIP.
Python
1
star
67

recommend-firefox

A web component for recommending the Firefox web browser.
JavaScript
1
star
68

hacker-news-poetry

Poetry generated programmatically from the front page of Hacker News. Reset hourly.
HTML
1
star
69

jamesg.blog.deb

An exploration of the .deb package format.
1
star
70

pandoc

The Pandoc script I used to generate the "Software Technical Writing: A Guidebook" e-book.
Shell
1
star
71

bpe

Byte-pair encoding implementation in Python.
Python
1
star
72

cash-counter-mobile

HTML
1
star
73

python-indieauth-helpers

IndieAuth authorization and callback helpers written in Python.
Python
1
star
74

letsjam

A static site generator built with Python and jinja2.
Python
1
star
75

highlight.js

Inline text highlights for web pages.
JavaScript
1
star
76

python-packaging-best-practices

Best practices for packaging and documenting Python packages ✨
1
star
77

title-prettier

A Python tool to normalize titles into a consistent format.
Python
1
star
78

wikitrends

Visualize Wikipedia traffic for specific pages.
HTML
1
star
79

lispDOT

A DOT DSL implemented in Common Lisp.
Common Lisp
1
star
80

trackback-server

A server to receive Trackbacks.
HTML
1
star
81

coffee-decision-tree

A decision tree showing how I decide what coffee to drink in a given moment.
Mermaid
1
star
82

fragmention.js

An implementation of the Fragmentation specification in JavaScript.
JavaScript
1
star
83

image-collage

Generate an image collage with computer vision.
Python
1
star
84

naive-bayes

A Naïve Bayes classifer implemented in Python.
Python
1
star
85

train-station-pianos

A directory of train station pianos.
HTML
1
star
86

rhyme-dictionary

A minimal rhyme dictionary.
HTML
1
star
87

vibes

Documenting a vibe in HTML.
HTML
1
star
88

venue-page-experiments

Exploration into simple, information-focused venue page design (i.e. cafes, restaurants).
HTML
1
star
89

hn-webmention

Send Webmentions from Hacker News to your personal website.
Python
1
star