Skip to content
Snippets Groups Projects
README.md 2.59 KiB
Newer Older
<!--
<p align="center">
  <img src="https://github.com///raw/main/docs/source/logo.png" height="150">
</p>
-->

<h1 align="center">
  vegetationcoverfraction
</h1>


## 💪 Getting Started

Compute fcover from 4P phenoscript output and using a DL model


## 🚀 Installation


#### Install from git:

```bash
pip install git+https://forgemia.inra.fr/ue-apc/modules/vegetationcoverfraction
```

#### Installation in development mode:
```bash
git clone https://forgemia.inra.fr/ue-apc/modules/vegetationcoverfraction
cd vegetationcoverfraction
pip install .
```


#### Command Line Interface
vegetationcoverfraction have a CLI writting with [Typer](https://typer.tiangolo.com/). The command to call in shell is fcover_rgb_drone. Call help to have all options:
```bash
fcover_rgb_drone --help
```

WARNING: If you change the cli.py script you have to reinstall vegetationcoverfraction to see the update the CLI typer application.

## 👐 Contributing

To ask for a modificatioins, bug fix or improvement proposal please add an issue on the project if you have access rights or contact maintainers: 

* Jordan Bernigaud Samatan (jordan.bernigaud-samatan@inrae.fr).


## Authors

* Jordan Bernigaud Samatan (Jordan Bernigaud Samatan)

### ⚖️ License

The code in this package is licensed under the MIT License.
BERNIGAUD SAMATAN JORDAN's avatar
BERNIGAUD SAMATAN JORDAN committed

# Method

## Global segmentation

We perform vegetation (including weed) segmentation via deep learning and using VegAnn model.

![image info](doc_imgs/veget_1.png)

## Remove out of ranks

BERNIGAUD SAMATAN JORDAN's avatar
BERNIGAUD SAMATAN JORDAN committed
The post processing RemoveOutofRanks (required : number of ranks to find) works according to the following steps 
BERNIGAUD SAMATAN JORDAN's avatar
BERNIGAUD SAMATAN JORDAN committed

### Detect lines in binary mask

We use the Hough transfor to infer the ranks localisation.

![image info](doc_imgs/veget_2.png)

We then extract the median angle of all lines and rotate the image so the lines are horizontal if it's not the case.

### Get rank width

Project mask on y axis, perform smoothing of the signal, perform background removal and peak extraction. For peak extraction we keep peaks that have value >= 0.5 * max peak (tunable parameter)

![image info](doc_imgs/veget_3.png)
![image info](doc_imgs/veget_5.png)
![image info](doc_imgs/veget_6.png)

We then estimate the width of the rank as the width corresponding to 0.8 * peak height (this parameter is tunable).
Finally the width is multiplied by 1 (tunable parameter).

We finally obtain the ranks bands

![image info](doc_imgs/veget_7.png)

which is then combined to the semantic mask.
BERNIGAUD SAMATAN JORDAN's avatar
BERNIGAUD SAMATAN JORDAN committed
Here we use voluntarily a very hard and contaminated plot.
BERNIGAUD SAMATAN JORDAN's avatar
BERNIGAUD SAMATAN JORDAN committed
![image info](doc_imgs/final_result.png)
BERNIGAUD SAMATAN JORDAN's avatar
BERNIGAUD SAMATAN JORDAN committed
But on an easier image : 
![image info](doc_imgs/final_result2.png)