Salient object detection

JustDeepIt supports users to perform object detection, instance segmentation, and salient object detection with GUI or CUI. In this tutorial, to overview of functions for salient object detection, we showed the usage of JustDeepIt for salient object detection with an artificial dataset.

Dataset

The artificial dataset used for this quick start is stored in GitHub (JustDeepIt/tutorials/SOD). The data folder contains images and masks folders. The images folder contains training images, and the masks folder contains mask images (annotation). The user can use git command to download the dataset from GitHub with the following script.

git clone https://github.com/biunit/JustDeepIt

ls JustDeepIt/tutorials/SOD
# data run_u2net.py

ls JustDeepIt/tutorials/SOD/data
# images masks
../_images/quickstart_sod_data.jpg

Settings

To start JustDeepIt, we open the terminal, as the following commands, change the current directory to JustDeepIt/tutorials/SOD, and run justdeepit command.

cd JustDeepIt/tutorials/SOD

justdeepit
# INFO:uvicorn.error:Started server process [61]
# INFO:uvicorn.error:Waiting for application startup.
# INFO:uvicorn.error:Application startup complete.
# INFO:uvicorn.error:Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

Then, we open the web browser and accesss to http://127.0.0.1:8000. At the startup screen, we press “Salient Object Detection” button to start salient object detection mode.

../_images/app_main.png

Next, at the Preferences screen, we set parameters as shown in the screenshot below. The workspace will be automatically set as the path of the current folder (e.g., JustDeepIt/tutorials/SOD, depending on the user’s environment). Then, we press button Load Workspace.

../_images/quickstart_sod_pref.png

Once the Preferences is set, the functions of Training and Inference become available.

Training

To train the model, we select tab Training and specify the model weight as the location storing the training weight, image folder as the folder containing training images (i.e., data/images), annotation as the folder containing mask images (i.e., data/masks), and annotation format as mask. The other parameters are set as shown in screenshot below. Note that the values of model weight, image folder, and annotation may be different from the screenshot depending on user’s environment. Then, we press button Start Training for model training.

../_images/quickstart_sod_train.png

Training takes 5-20 minutes, and it depends on the computer hardware.

Inference

In tab Inference, the model weight is specified to the training weights, whose file extension is .pth in general. We specify image folder to the folder containing the images for inference. Here, for convenience, we use the training images (e.g., data/images) for inference. Note that the values of model weight and image folder may be different from the screenshot depending on user’s environment. Then, we press button Start Inference for inference.

../_images/quickstart_sod_eval.png

The inference results will be stored in the folder justdeepitws/outputs of the workspace. Examples of inference results are shown in the figure below. Black background indicates that there is no objects.

../_images/quickstart_sod_inference_output.png

API

Training and inference can be performed using the JustDeepIt API. Python script run_justdeepit.py stored in GitHub (JustDeepIt/tutorials/SOD) can be used for this purpose.

cd JustDeepIt/tutorials/SOD

python scripts/run_justdeepit.py