# AMFinder
The Automatic Mycorrhiza Finder (AMFinder) allows for automatic computer
vision-based identification and quantification of AM fungal colonisation
and intraradical hyphal structures on ink-stained root images using
convolutional neural networks.
## Summary
1. [Command-line script (`amf`)](#amf)
2. [Standalone interface (`amfbrowser`)](#amfbrowser)
## Command-line script (`amf`)<a name="amf"></a>
### Installation instructions
`amf` requires at least **Python 3.6**. Below is a typical installation, using
a virtual environment to install dependencies:
```bash
$ python3.7 -m venv amfenv
$ source amfenv/bin/activate
(amfenv) $ python -m pip install -r requirements.txt
(amfenv) $ deactivate
```
**Note:** `amf` is not compatible with the latest Keras/Tensorflow versions due
to [a bug affecting class weights](https://github.com/tensorflow/tensorflow/issues/40457).
### Prediction mode
Predict fungal colonisation or intraradical hyphal structures within plant root images.
```
$ amf predict <options> <jpeg/tiff images>
```
Available `<options>` are listed below:
|Short|Long|Description|Default|
|-|-|-|-|
|`-h`|`--help`|Display this help.|
|`-t`|`--tile_size`| Tile size, in pixels.|126|
|`-net`|`--network`|Select a pre-trained network in `trained_networks`.|None|
Pre-trained networks are available in folder [`trained_networks`](amf/trained_networks):
|File name|Annotation level|Description|
|-|-|-|
|[CNN1v1.h5](amf/trained_networks/CNN1v1.h5)</a>|Stage 1|Ink-stained, ClearSee-treated root pictures (flatbed scanner/microscope).|
|[CNN1v2.h5](amf/trained_networks/CNN1v2.h5)|Stage 1|Same, but hue- and saturation-insensitive.|
|[CNN2v1.h5](amf/trained_networks/CNN2v1.h5)|Stage 2|Ink-stained, ClearSee-treated microscope root pictures.|
### Training mode
Train `amf` on a different image dataset, or refine existing models.
```
$ amf train <options> <jpeg/tiff images>
```
Available `<options>` are listed below:
|Short|Long|Description|Default|
|-|-|-|-|
|`-h`|`--help`|Display this help.|
|`-t`|`--tile_size`| Tile size, in pixels.|126|
|`-b`|`batch_size`|Training batch size.|32|
|`-k`|`--keep_background`|Do not skip any background tile.|False|
|`-a`|`--data_augmentation`|Activate data augmentation.|False|
|`-s`|`--summary`|Save CNN architecture and graph.|False|
|`-o`|`--outdir`|Folder where to save trained model and CNN architecture.|cwd|
|`-e`|`--epochs`|Number of training cycles.|100|
|`-p`|`--patience`|Number of epochs to wait before early stopping.|12|
|`-lr`|`--learning_rate`|Learning rate used by the Adam optimiser.|0.001|
|`-vf`|`--validation_fraction`|Fraction of tiles used as validation set.|15%|
|`-1`|`--CNN1`|Train for root colonisation.|True|
|`-2`|`--CNN2`|Train for intraradical hyphal structures.|False|
|`-net`|`--network`|Name of the pre-trained network.|None|
For large datasets, running the script on a high-performance computing (HPC)
equipment is recommended. An example using [Slurm](https://slurm.schedmd.com/)
workload manager is provided below.
```bash
#! /bin/bash
#SBATCH -e train.err
#SBATCH -o train.out
#SBATCH --mem=10G
#SBATCH -n 10
BASE=/home/user/amf
source $BASE/amfenv/bin/activate
$BASE/amf train $BASE/training_data/*jpg
deactivate
```
### Diagnostic mode
Use the following command to determine **precision** and **specificity** of a
trained network:
```bash
$ amf diagnose -net <trained_network> <images>
```
## Standalone interface (`amfbrowser`)<a name="amfbrowser"></a>
The standalone interface `amfbrowser` allows to browse, amend and validate
`amf` predictions. Installation instructions are detailed below for the main
platforms.
![](doc/amfbrowser.png)
### Installation instructions<a name="amfbrowseronlinux"></a>
#### Linux
1. Download and install the OCaml package manager
[OPAM](https://opam.ocaml.org/doc/Install.html).
2. Using [`opam switch`](https://opam.ocaml.org/doc/Usage.html#opam-switch),
install **OCaml 4.08.0** (older versions won't work).
3. Install `amfbrowser` dependencies:
```bash
$ opam install dune odoc lablgtk cairo2 cairo2-gtk magic-mime camlzip
```
You may be required to install development packages, including
`libgtk2.0-dev` and `libgtksourceview2.0-dev`.
4. Retrieve `amfbrowser` sources and build:
```
$ git clone [email protected]:SchornacklabSLCU/amfinder.git
$ cd amfinder/amfbrowser
$ ./build.sh
```
5. Copy the folder `data` to your local application folder. A typical path
would be `~/.local/share/amfinder/data`.
6. The binary `amfbrowser.exe` is ready to use.
#### MacOS
Same as Linux, but you will need [Homebrew](https://brew.sh/index_fr) to
install packages.
#### Windows 10
`amfbrowser` can be installed and run on Windows 10 after activation of the
Windows Subsystem for Linux (WSL). WSL runs a a GNU/Linux environment directly
on Windows, unmodified. **Admin rights are required to activate WSL**.
1. Activate the [Windows Subsystem for Linux
(WSL)](https://docs.microsoft.com/en-us/windows/wsl/install-win10). Then, go to
Windows App store and install a Linux distribution
(recommended distributions are [Ubuntu](https://ubuntu.com/) and
[Debian](https://www.debian.org/index.html), but many others should work too).
2. Install an OCaml build system based on the `brew` package manager:
```bash
$ sudo apt update
$ sudo apt upgrade
$ sudo apt autoclean
$ sudo apt install curl build-essential git
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
$ test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv)
$ test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
$ test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >> ~/.bash_profile
$ echo "eval \$($(brew --prefix)/bin/brew shellenv)" >> ~/.profile
$ brew install gpatch opam gtk+ cairo
```
3. Follow the [Linux installation instructions](#amfbrowseronlinux). Please note
that sandboxing does not work on Windows. OPAM should be initialized using
`opam init --disable-sandboxing`.
4. Install a X server (for instance, [Xming](https://sourceforge.net/projects/xming/)),
then configure bash to tell GUIs to use the local X server. For instance, use
`echo "export DISPLAY=localhost:0.0" >> ~/.bashrc`. Detailed instructions are
available on the internet.
没有合适的资源?快使用搜索试试~ 我知道了~
amfinder:AMFinder套件包含Python脚本,该脚本可从墨迹斑斑的植物根部图片中对菌根结构进行高通量注释,以及用于...
共142个文件
ml:38个
mli:37个
png:29个
需积分: 9 2 下载量 193 浏览量
2021-03-06
01:40:17
上传
评论 1
收藏 123.61MB ZIP 举报
温馨提示
AMFinder 自动菌根查找器(AMFinder)可以使用卷积神经网络基于计算机视觉自动识别和量化墨水染色的根图像上的AM真菌定植和自由基内菌丝结构。 概括 命令行脚本( amf ) 安装说明 amf至少需要Python 3.6 。 以下是使用虚拟环境安装依赖项的典型安装: $ python3.7 -m venv amfenv $ source amfenv/bin/activate (amfenv) $ python -m pip install -r requirements.txt (amfenv) $ deactivate 注意:由于 amf与最新的Keras / Tensorflow版本不兼容。 预测模式 预测植物根图像中的真菌定植或自由基内菌丝结构。 $ amf predict <options> <jpeg> 可用的<options>列出
资源详情
资源评论
资源推荐
收起资源包目录
amfinder:AMFinder套件包含Python脚本,该脚本可从墨迹斑斑的植物根部图片中对菌根结构进行高通量注释,以及用于手动管理和生成热图的功能齐全的浏览器 (142个子文件)
amf 2KB
dep_graph.dot 1KB
dune 124B
dune-project 48B
dune-workspace 166B
2020_09_11_castanet_editor.exe 6.2MB
CNN2v1.h5 44.79MB
CNN1v1.h5 16.32MB
CNN1v2.h5 16.32MB
Nbenth_Rirregularis_high_magnification.jpg 42.83MB
Nbenth_Rirregularis_flatbed_scanner.jpg 13.03MB
LICENSE 1KB
README.md 6KB
SCRIPTS.md 4KB
INSTALL.md 2KB
BROWSER.md 0B
amfSurface.ml 21KB
imgBrush.ml 15KB
uIPredictions.ml 13KB
amfImage.ml 10KB
imgPredictions.ml 9KB
amfCallback.ml 7KB
imgAnnotations.ml 6KB
morelib.ml 6KB
uILayers.ml 5KB
imgUI.ml 5KB
amfUI.ml 5KB
imgCursor.ml 5KB
uIToggleBar.ml 4KB
uITileSet.ml 4KB
imgDraw.ml 4KB
amfLevel.ml 4KB
imgActivations.ml 4KB
amfIcon.ml 4KB
amfAnnot.ml 3KB
imgPointer.ml 3KB
uIMagnifier.ml 3KB
uIDrawing.ml 3KB
uILevels.ml 3KB
amfMemoize.ml 3KB
uIFileChooser.ml 3KB
amfbrowser.ml 3KB
imgTileMatrix.ml 2KB
amfPar.ml 2KB
amfColor.ml 2KB
uIHelper.ml 2KB
imgSource.ml 2KB
uITools.ml 2KB
amfLog.ml 2KB
imgShared.ml 2KB
amfLang.ml 2KB
err.ml 1KB
amfConst.ml 1KB
imgFile.ml 1KB
morelib.mli 6KB
amfLevel.mli 4KB
imgBrush.mli 4KB
amfSurface.mli 4KB
amfImage.mli 3KB
imgPredictions.mli 3KB
amfAnnot.mli 3KB
amfCallback.mli 3KB
uIMagnifier.mli 2KB
amfUI.mli 2KB
uIPredictions.mli 2KB
imgAnnotations.mli 2KB
imgCursor.mli 2KB
amfColor.mli 2KB
imgUI.mli 2KB
amfConst.mli 2KB
uIToggleBar.mli 2KB
amfIcon.mli 2KB
imgPointer.mli 2KB
amfMemoize.mli 2KB
uITileSet.mli 2KB
uILayers.mli 2KB
uILevels.mli 2KB
uIDrawing.mli 2KB
amfLog.mli 2KB
imgDraw.mli 2KB
uIHelper.mli 2KB
imgShared.mli 2KB
imgSource.mli 2KB
amfPar.mli 2KB
uIFileChooser.mli 2KB
uITools.mli 2KB
imgActivations.mli 2KB
imgTileMatrix.mli 1KB
amfLang.mli 1KB
imgFile.mli 1KB
err.mli 1KB
viridis.palette 200B
pal12.palette 200B
pal3.palette 200B
plasma.palette 200B
pal11.palette 200B
cividis.palette 200B
amfbrowser_implementation_details.pdf 364KB
amfbrowser.png 749KB
dep_graph.png 229KB
共 142 条
- 1
- 2
钟离舟
- 粉丝: 34
- 资源: 4667
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0