10.8 Quevedo as a library
Quevedo can be used as a command line application to manage a dataset, but it can also be used from other Python code to make programatic access to the dataset more convenient, or in user scripts run by Quevedo on the dataset objects.
10.8.1 Call from python
To use Quevedo from other python code, you can import it with import quevedo
,
or it may be more useful to directly import the Dataset class: from quevedo import Dataset
.
This class has most of the functionality to deal with Quevedo
datasets, including managing the data and the neural networks. There
are some examples of use in the examples directory (https://github.com/agarsev/quevedo/tree/master/examples)
of the repo, and we try to keep the code readable to help understand
the library. The full API reference with the different classess and
methods can be read at https://agarsev.github.io/quevedo/latest/api.
10.8.2 User scripts
Every dataset is different, and dealing with data often needs to
have custom procedures and algorithms, specific to the problem at
hand. We suggest to place these scripts in the scripts
directory of the dataset, to keep them organized. Quevedo can also
help run scripts in this directory using the command run_script
.
With run_script
, you don’t need to write the
boilerplate code of accessing all the annotations, loading their data
and image, and saving them. Just provide a process
function, which receives an annotation object and the dataset, and
process the annotation with your custom logic. The
run_script
command then lets you specify, using syntax
similar to the other commands, what subsets to run the script in.
Another advantage of user scripts is that Quevedo makes them available on the web interface (Section 10.7.3.0.2). The top right corner of the annotation page has a listing of functions, including trained neural networks and user scripts, that can be run, allowing annotators to access this functionality directly from the web interface. If the script is used from the web interface, the annotation won’t be automatically saved, allowing the user to review the results before clicking save.
10.8.3 Modifying Quevedo
Quevedo is open source! You can modify and extend it by forking it on GitHub: https://github.com/agarsev/quevedo. If you use Quevedo for your research and have ideas for improvement, please do get in touch via GitHub discussions or email.