Download Software to Help Run Post-Processing Scripts
Download all these and install them on your computer.
- Github Desktop
- Python (Currently it is using Python 3.12- later versions might give grumpiness)
- Visual Studio Code (This is an interface for running and using code)
- ExifTool
Download Mothbot Scripts
First you can download our collection of Python scripts that help you process your data! It’s easy to get the latest versions of the scripts that we update through Github. First, go to the Mothbox’s Github Site
Then click on the button that says “code.”
You can click “Open with Github Desktop,” (or Download ZIP if you didn’t install the Github desktop app.)
Now you will have a folder on your computer that has all the Mothbox files on it. (From github Desktop you can click “CTRL+F” to see the folder on your computer. If you look into this set of scripts you downloaded, you can go into the Mothbox>AI folder to see all the postprocessing scripts.
Open Visual Studio Code
Visual Studio Code is an open source editor for dealing with programming scripts. It has some handy built-in features that will help us run this code you downloaded. Open the program. Click “Open Folder” The folder you want to open is called “Mothbot” inside the folder called “AI” in the github folder.
Now at the top of Visual Studio Code click “Terminal>New Terminal”
This opens a special zone at the bottom of the screen that lets us configure some software in special ways. You will use this to type special codes in to set up your computer to prepare it for processing data!
Set up coding managed environment with uv
In order for custom scripts to run on a computer, they often need to reference specific libraries. Big projects might use many different libraries together to perform a task, and it can get tricky to manage all the different libraries that might need to be installed on your system. On top of that, sometimes these libraries get updated in ways that are incompatible with others versions of other software. In order to help make this easier, we can install a special program called a package manager. We are using a thing called “uv”
Install UV
There’s guides available about how to install, but the easiest way is just to type this in the terminal
pip install uv
Go to Mothbot Directory Since you opened this folder, your terminal should say that it is in the correct directory (“Mothbox/AI/Mothbot”).
But if your terminal says something else, click in the terminal change the directory to the directory where your AI/Mothbot folder is (that you downloaded from the github) for instance on my computer, I type:
cd C:\Users\andre\Documents\GitHub\Mothbox\AI\Mothbot
next run each of these lines, and press enter after each line. (After the first line, it might ask you if you want to replace an existing environment, you can say yes!)
uv venv
.venv\Scripts\activate
NOTE: If you are using windows, you might get an error after you write the “activate” line. The error will likely look like this
Press the windows-button on your keyboard.
2. Type ‘PowerShell’
3. Right-click Windows PowerShell
4. Click Run as Administrator
5. Run the following command and confirm with ‘Y’
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
NOTE: If you are using a Mac, you will have to add the word ‘source’ at the front of this line of code.
source .venv\Scripts\activate
Now run this again
.venv\Scripts\activate
and it should work!
now your terminal should have a little marking on the left side that shows you are inside a custom “environment.” It probably says “Mothbot”
now we will use the magic of uv to install all the things this software needs in one step
uv pip install -r requirements.txt
This might take a little bit as it downloads all the extra software you need (and the correct versions we need!).
Auto Activate virtual environment in VS Code
We want to do one more thing in Visual Studio code to make sure it defaults to activating this cool (Mothbot) environment we just set up.
Following the instructions from this helpful post,
- Ctrl+Shift+P,
search for “User Settings (JSON)”
- Add the following two lines: Solution for Windows
"python.terminal.activateEnvInCurrentTerminal": true, "python.defaultInterpreterPath": "${workspaceFolder}\\.venv\\Scripts\\python.exe",
Solution for Linux/MacOS
"python.terminal.activateEnvInCurrentTerminal": true, "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
Note how there might already be a line that says “python.defaultInterpreterPath,” that’s ok, you can paste your new line below it and it will override that. Or you can even comment it out with // just in case
Now you can run scripts!
Your environment should be set up, and now after this, you can run scripts!
Run scripts by typing in the names of the scripts
python Mothbot_Detect.py
Or replace that script name with any script you want to run (like Mothbot_ID.py)
Or Run scripts in Visual Studio with a Big Button
You can open scripts in your folder and then just hit the big “|>” run button
(Note you might need to re-activate your environment at the bottom of the screen in the terminal before hitting the Run button
.venv\Scripts\activate
OR if you have a Mac:
source .venv\Scripts\activate
)
Go to the Next Steps
Next follow the other instructions on this site for each part of the post-processing steps to turn your data from photos to rich documents full of taxonomical and metadata information!