https://github.com/capjamesg/visionscript Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Customer Stories + White papers, Ebooks, Webinars + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. {{ message }} capjamesg / visionscript Public * Notifications * Fork 6 * Star 75 A high-level programming language for using computer vision. visionscript.dev/ License MIT license 75 stars 6 forks Activity Star Notifications * Code * Issues 2 * Pull requests 1 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights capjamesg/visionscript This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/c] Use Git or checkout with SVN using the web URL. [gh repo clone capjam] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @capjamesg capjamesg finish Remove[] implementation ... 1c70fee Aug 21, 2023 finish Remove[] implementation 1c70fee Git stats * 94 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github commit action templates July 13, 2023 19:50 tests create web interface, make notebooks work, add notebook import export July 8, 2023 10:33 visionscript finish Remove[] implementation August 21, 2023 22:18 .gitignore create web interface, make notebooks work, add notebook import export July 8, 2023 10:33 CITATION.cff add citation file July 8, 2023 13:18 CONTRIBUTING.md Update CONTRIBUTING.md August 18, 2023 17:30 CONTRIBUTORS.md fix test suite, add color feature to replace[], update tests July 7, 2023 00:37 LICENSE add project license July 6, 2023 00:53 MANIFEST.in start work on notebook, add new syntax, work on docs July 6, 2023 17:15 Makefile ux improvements to notebooks, work on cloud, bug fixes, improve state... July 10, 2023 00:09 README.md add demo, update examples August 21, 2023 21:58 requirements.txt work on requirements and setup July 10, 2023 17:19 setup.py work on requirements and setup July 10, 2023 17:19 View code [ ] VisionScript Get Started Run a File Use VisionScript in a Notebook Quickstart Find people in an image using object detection Find people in all images in a folder using object detection Replace people in a photo with an emoji Classify an image Installation Run in debug mode Inspiration Syntax Lexical Inference and Memory Developer Setup Supported Models License README.md 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. About A high-level programming language for using computer vision. visionscript.dev/ Topics computer-vision programming-languages visionscript Resources Readme License MIT license Activity Stars 75 stars Watchers 4 watching Forks 6 forks Report repository Contributors 2 * @capjamesg capjamesg James * @mahimairaja mahimairaja Mahimai Raja J Languages * Python 59.3% * JavaScript 25.7% * HTML 8.6% * CSS 6.3% * Makefile 0.1% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.