-
Notifications
You must be signed in to change notification settings - Fork 18
4a Context classification
The script inference.py
classifies each image for the following eight contextual attributes:
- panoramic status (True, False)
- lighting condition (day, night, dawn/dusk)
- weather (clear, cloudy, rainy, snowy, foggy)
- platform (walking surface, driving surface, cycling surface, railway, fields, tunnel)
- view direction (front/back, side)
- quality (good, slightly poor, very poor)
- presence of glare (yes, no)
- presence of reflection (yes, no)
Set up environment with requirements-cv-linux.txt
.
Input
The input CSV should:
- have each row representing an image to process, and
- contain minimally two columns, named
uuid
andpath
, to specify image UUID and the local image file path, respectively
Output
One CSV for each contextual attribute.
Each CSV contains two columns: uuid
s and the inferred contextual classes.
Models
The pretained models will be automatically downloaded when running inference.py
(recommended method).
You can also manually download the models here.
To reproduce sample_output
Modify inference.py
:
- Modify
out_folderPath
to the directory you wish to store the output CSVs - Modify
batch_size
to suit your GPU capacity
Run:
python3 inference.py
Modify inference.py
:
- Modify
out_folderPath
to the directory you wish to store the output CSVs - Modify
in_csvPath
to your input CSV file path - Modify
batch_size
to suit your GPU capacity
Run:
python3 inference.py
This section trains classification models based on the contextual labels in manual_labels/*
.
Download labels from the above link. Unzip all images into img/
folder.
Adjust ROOT_PATH
in config.yaml
to point at the directory of manual_labels
, in which train/
, test/
, and img/
folders are expected to exist.
Please also make sure you have a wandb account and have created a team which is set as the default location for storing runs. After that, run wandb login
in your terminal.
chmod +x cv.multiruns.sh
bash cv_multiruns.sh
chmod +x run_combinations.sh
bash run_combinations
All trained models, their performance metrics and confusion matrix plots are stored here.
Adjust parameters in config.yaml
and run python train_and_test.py