This repository contains code snippets you may integrate with your scripts to process your data before sending it to Centaur Labs. Some recipes might need to be used sequentially.
- abs_to_wkt
- add_tracking_line_to_plot
- audio_to_mel_spectrogram
- audio_to_video
- cocojson_to_csv
- coordinate_converter
- dicom_to_image
- entity_highlights
- mask_to_wkt
- multi_paragraph_text
- video_to_image
- wkt_to_mask
The recipes in this repository require Python 3.9+ to run. You may install python from: https://www.python.org/downloads/. Generally, each recipe folder will contain specific instructions on how to install and use the recipe. Below you can find instructions on how to set up a virtual environment as well as how to use one with a Jupyter notebook.
After you've downloaded a recipe and any associated files, it is highly recommended creating a new virtual environment for the script you will write.
To create a virtual environment using the default python virtual environment manger:
- Open up a terminal or command prompt and navigate to the directory containing the notebook.
- Then create a virtual environment using
python -m venv env_name
whereenv_name
can be changed as desired. - Activate the virtual environment by using one of the following commands
depending on your operating system:
- Unix/macOS:
source env_name/bin/activate
- Windows:
.\env_name\Scripts\activate
- Unix/macOS:
- To deactivate the virtual environment you can type
deactivate
in the terminal or command prompt
For recipes that are Jupyter notebooks, or if you are just working in one perform these additional steps to ensure the notebook is using the correct virtual environment and installed packages. Some IDEs may handle selecting the correct virtual environment for you, in which case you only need to do step 1.
- With the environment activated, run
pip install -r requirements.txt
from the terminal or command prompt. This should install jupyter as well as the other required packages. - Run
python -m ipykernel install --user --name env_name
whereenv_name
is the name of the currently activated virtual environment. - Now start the Jupyter notebook with
jupyter notebook path/to/notebook.ipynb
The notebook should open in your default browser. - In the top toolbar click on
Kernel
and then selectChange kernel
. - Select the kernel that has the same name as your virtual environment.
- Now you may follow any remaining instructions in the notebook.