Water level measurement
Overviews
Using SAM and SOLOv2 to detect and measure water level
Please install ecos_core-1.1.0 or newest version and AdelaiDet-0.2.0 beforehand.
pip install ecos_core-1.1.0.zip
pip install AdelaiDet-0.2.0.zip
Prepare your dataset
# your dataset structure should be like this
datasets/
-annotations/
- instances_train2017.json
- instances_val2017.json
-train2017/
-*.jpg
-val2017/
-*.jpg
Usages
1. For training, run:
python train.py --opt-solo "<PATH_TO_OPT_FILE>"
Example:
python train.py --opt-solo ./opt.json
PATH_TO_OPT_FILE
is path to file opt.json
2. For testing, run:
python predict.py --input-path "<PATH_TO_TEST_IMG>" --opt-sam "<PATH_TO_SAM_OPT_FILE>" --opt-solo "<PATH_TO_SOLOV2_OPT_FILE>" --output-path "<PATH_TO_OUTPUT_IMG>"
or
python predict.py --input-path ./../../../riwa_v2/test/images/ADE_train_00004363.jpg --opt-sam ./../../ecos_core/SAM/opt.json --opt-solo ./opt.json --output-path test.png
PATH_TO_TEST_IMG
should be where the image file arePATH_TO_OUTPUT_IMG
where result will be savedPATH_TO_SAM_OPT_FILE
is path to file opt.json of SAMPATH_TO_SOLOV2_OPT_FILE
is path to file opt.json of SOLOv2- If the prediction is not good, please consider tuning the threshold or adding more data