Since different vision tasks require a unified format to be compatible with the semi-supervised algorithms in PixelSSL, in the folder pixelssl/task_template
, we provide a template for encapsulating the task code. The template consists of five files:
pixelssl/task_template # task template folder
├── __init__.py
├── criterion.py # template of the task criterions (losses)
├── data.py # template of the task datasets
├── func.py # template of the task-specific functions
├── model.py # template of the task models
├── proxy.py # template of the task proxy
In this template, we split the main components used in deep learning into the files data.py
, model.py
, and criterion.py
. We put task-specific functions (required by different semi-supervised algorithms) in the file func.py
. In addition, we define the deep learning pipeline in the file proxy.py
.
To implement a new task code based on the latest PixelSSL project, you should complete the following steps (assuming you are currently at the root path of the project):
-
Create a new task folder
task/xxx
, wherexxx
is the unique name of the task. Then create the file__init__.py
. -
Create five files (
criterion.py
,model.py
,data.py
,func.py
,proxy.py
) under the foldertask/xxx
. These files should inherit from the corresponding files under the folderpixelssl/task_template
. Each file contains several classes and the corresponding export functions:
(a) Each class implements a task-specific component
(b) Each export function exports the corresponding class for calling in the script
Please refer to the comments of the files under the folderpixelssl/task_template
and other implemented task codes for more details. -
Create the file
task/xxx/requirements.txt
and add task-specific python dependencies into it. -
Create the folder
task/xxx/dataset
and put your task-specific datasets in it. -
Create the folder
task/xxx/script
and implement scripts inside it. Please refer to the scripts of other implemented task codes for more details. -
Create the folder
task/xxx/pretrained
to save the pretrained models if necessary. -
Create the file
README.md
to describe how to prepare and run the task code.
Now you can run your task codes with the semi-supervised algorithms according to the Getting Started document!
If you want to call the provided semi-supervised algorithms in your own project, please install PixelSSL in your python environment and use our task template to encapsulate your code.