RESEARCH PROJECT

Recognition of weed classes from hypespectral images of wheat fields¶

A talk to the Department of Remote Sensing - Warsaw University of Life Sciences

Dr. Anderson Rodrigo da Silva - Goiano Federal Institute, Brazil

Sept. 3, 2021

In [4]:
# pip install RISE
Collecting RISE
  Downloading rise-5.7.1-py2.py3-none-any.whl (4.3 MB)
     |████████████████████████████████| 4.3 MB 4.5 MB/s eta 0:00:01
Requirement already satisfied: notebook>=6.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from RISE) (6.2.0)
Requirement already satisfied: terminado>=0.8.3 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (0.9.2)
Requirement already satisfied: jupyter-core>=4.6.1 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (4.7.1)
Requirement already satisfied: prometheus-client in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (0.9.0)
Requirement already satisfied: traitlets>=4.2.1 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (4.3.3)
Requirement already satisfied: ipykernel in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (5.5.0)
Requirement already satisfied: jinja2 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (2.11.3)
Requirement already satisfied: ipython-genutils in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (0.2.0)
Requirement already satisfied: argon2-cffi in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (20.1.0)
Requirement already satisfied: nbformat in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (5.1.2)
Requirement already satisfied: Send2Trash>=1.5.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (1.5.0)
Requirement already satisfied: tornado>=6.1 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (6.1)
Requirement already satisfied: jupyter-client>=5.3.4 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (6.1.11)
Requirement already satisfied: nbconvert in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (6.0.7)
Requirement already satisfied: pyzmq>=17 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from notebook>=6.0->RISE) (22.0.3)
Requirement already satisfied: python-dateutil>=2.1 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from jupyter-client>=5.3.4->notebook>=6.0->RISE) (2.8.1)
Requirement already satisfied: six>=1.5 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from python-dateutil>=2.1->jupyter-client>=5.3.4->notebook>=6.0->RISE) (1.15.0)
Requirement already satisfied: ptyprocess in /srv/conda/envs/notebook/lib/python3.6/site-packages (from terminado>=0.8.3->notebook>=6.0->RISE) (0.7.0)
Requirement already satisfied: decorator in /srv/conda/envs/notebook/lib/python3.6/site-packages (from traitlets>=4.2.1->notebook>=6.0->RISE) (4.4.2)
Requirement already satisfied: cffi>=1.0.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from argon2-cffi->notebook>=6.0->RISE) (1.14.5)
Requirement already satisfied: pycparser in /srv/conda/envs/notebook/lib/python3.6/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=6.0->RISE) (2.20)
Requirement already satisfied: ipython>=5.0.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipykernel->notebook>=6.0->RISE) (7.16.1)
Requirement already satisfied: pickleshare in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (0.7.5)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (3.0.16)
Requirement already satisfied: jedi>=0.10 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (0.17.2)
Requirement already satisfied: backcall in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (0.2.0)
Requirement already satisfied: pexpect in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (4.8.0)
Requirement already satisfied: pygments in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (2.8.0)
Requirement already satisfied: setuptools>=18.5 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (49.6.0.post20210108)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (0.7.1)
Requirement already satisfied: wcwidth in /srv/conda/envs/notebook/lib/python3.6/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->notebook>=6.0->RISE) (0.2.5)
Requirement already satisfied: MarkupSafe>=0.23 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from jinja2->notebook>=6.0->RISE) (1.1.1)
Requirement already satisfied: jupyterlab-pygments in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (0.1.2)
Requirement already satisfied: entrypoints>=0.2.2 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (0.3)
Requirement already satisfied: pandocfilters>=1.4.1 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (1.4.2)
Requirement already satisfied: defusedxml in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (0.6.0)
Requirement already satisfied: testpath in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (0.4.4)
Requirement already satisfied: bleach in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (3.3.0)
Requirement already satisfied: mistune<2,>=0.8.1 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (0.8.4)
Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbconvert->notebook>=6.0->RISE) (0.5.2)
Requirement already satisfied: nest-asyncio in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=6.0->RISE) (1.4.3)
Requirement already satisfied: async-generator in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=6.0->RISE) (1.10)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from nbformat->notebook>=6.0->RISE) (3.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook>=6.0->RISE) (0.17.3)
Requirement already satisfied: importlib-metadata in /srv/conda/envs/notebook/lib/python3.6/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook>=6.0->RISE) (3.4.0)
Requirement already satisfied: attrs>=17.4.0 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat->notebook>=6.0->RISE) (20.3.0)
Requirement already satisfied: packaging in /srv/conda/envs/notebook/lib/python3.6/site-packages (from bleach->nbconvert->notebook>=6.0->RISE) (20.9)
Requirement already satisfied: webencodings in /srv/conda/envs/notebook/lib/python3.6/site-packages (from bleach->nbconvert->notebook>=6.0->RISE) (0.5.1)
Requirement already satisfied: zipp>=0.5 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat->notebook>=6.0->RISE) (3.4.0)
Requirement already satisfied: typing-extensions>=3.6.4 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat->notebook>=6.0->RISE) (3.7.4.3)
Requirement already satisfied: pyparsing>=2.0.2 in /srv/conda/envs/notebook/lib/python3.6/site-packages (from packaging->bleach->nbconvert->notebook>=6.0->RISE) (2.4.7)
Installing collected packages: RISE
Successfully installed RISE-5.7.1
Note: you may need to restart the kernel to use updated packages.

Problematization¶

Weed infestation in a cotton field. Source: Bogiani (Embrapa), 2017

Infestation of Ipomoea sp. in a sugarcane field. Source: Hirata (Campos e Negócios), 2016

How are we controlling weeds?¶

Source: Comas (Embrapa), 2016

Weed scouting in a sugarcane field. Source: Christoffoleti, 2019 (https://www.grupocultivar.com.br/)

Herbicide resistance. Source: https://www.upherb.com.br/

Okay! But what about Poland?¶

  • 26 cases of weed resistance to herbicides
  • 12 on winter wheat!

Source: Heap, 2021 (http://www.weedscience.org/)

And what should we do about it?¶

Adapted from Shawn, 2005 (Front. Ecol. Environ.)

And to automatically discriminate monocots and dicots:¶

Source: Da Silva, 2019 (J. Appl. Remote Sens.)

The main objective¶

To detect and discriminate grassy and broadleaf weeds using UAV hyperspectral images of winter wheat fields.

Methodology¶

Field plots¶

Reflectance conversion¶

$R = \frac{V_{Raw} - V_D}{V_W - V_D}$

Segmentation of vegetation/background¶

$ExG = 2R_{550} - R_{650} - R_{480}$

Otsu (Adaptive) thresholding

Detection of crop rows¶

Seeder coordinates or... Segmented image $\rightarrow$ Image thinning $\rightarrow$ (Morph. operation) $\rightarrow$ Hough transform

FD-SLIC superpixels¶

  • Spectral + spatial info.
  • Number of superpixels: 0.1% - 0.5% of image dimension
  • Texture features...

Relative importance of spectral bands for discriminating superpixels¶

  • Mahalanobis generalized distance $\rightarrow$ Singh (1981) criterion
  • $ D^2_{ij} = (R_i - R_j)^T \Sigma^{-1} (R_i - R_j) $, where $\Sigma$ is a covariance matrix of spectral bands
  • Eigenvectors (SVD) of $\Sigma$

Weed classification¶

  • Machine Learning: CNN x SVM x Mixture discriminant analysis
  • Spx. partitions: Training (70%) x Validation (30%)
  • Apparent error rate
  • Field validation
  • (Deploy the model)

Some references¶

  • Bah, M. D., Hafiane, A., & Canals, R. (2018). Deep learning with unsupervised data labeling for weed detection in line crops in UAV images. Remote sensing, 10(11), 1690.
  • Psalta, A., Karathanassi, V., & Kolokoussis, P. (2016). Modified versions of SLIC algorithm for generating superpixels in hyperspectral images. 2016 8th Workshop on Hyperspectral Image and Signal Processing: Evolution in Remote Sensing (WHISPERS), 1-5.
  • Li, Y., Al-Sarayreh, M., Irie, K., Hackell, D., Bourdot, G., Reis, M. M., & Ghamkhar, K. (2021). Identification of weeds based on hyperspectral imaging and machine learning. Frontiers in Plant Science, 11, 2324.
  • Singh, D. (1981) The relative importance of characters affecting genetic divergence. Indian Journal Genetics & Plant Breeding, 41:237-245.

Dziękuję bardzo!¶

anderson.silva@ifgoiano.edu.br