1
0
Fork 0
PlantNetLibre-300K/README.md

188 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

2023-07-03 20:21:12 -06:00
# PlantNet-300K Forklet
This is a forklet of the PlantNet-300K training repository.
2023-07-04 10:18:39 -06:00
Related repository:
* https://spacecruft.org/deepcrayon/PlantNetLibre
2023-07-03 20:21:12 -06:00
2023-07-03 20:50:49 -06:00
# Install
Install thusly.
Using Debian Stable (12/Bookworm).
## Dependencies
Debian package dependencies.
```
sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils \
tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev \
python3-virtualenv python3-pip cmake-curses-gui cmake \
libudev-dev libsystemd-dev
```
## Python
The Python setup is a bit involved, but very flexible.
This setup will allow for any particular version of Python to be
installed and used.
This will also set up a virtual environment for `pip` installs.
Firstly, setup `pyenv` to install and use any version of Python
```
curl https://pyenv.run | bash
```
Add these lines to the `~/.bashrc`:
```
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
```
Then log out and log back in. The following command should work:
```
pyenv versions
```
Now install various version(s) of Python:
```
pyenv install 3.11
pyenv install 3.10
```
2023-07-05 15:48:22 -06:00
## PlantNetLibre-300K
2023-07-03 20:50:49 -06:00
Clone the repo and set up Python environment.
Flavor Python version to taste.
```
2023-07-05 15:48:22 -06:00
git clone https://spacecruft.org/deepcrayon/PlantNetLibre-300K
cd PlantNetLibre-300K/
2023-07-03 20:50:49 -06:00
pyenv local 3.11
virtualenv -p python3.11.4 env
source env/bin/activate
python --version
```
Install PyTorch and dependencies.
This is for NVidia CUDA.
Install `lit` first or install fails (just repeat install to fix).
```
pip install --upgrade pip
pip install lit
pip install torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu118
2023-07-03 22:52:20 -06:00
pip install -r requirements.txt
2023-07-03 20:50:49 -06:00
```
## Images
Set up data archive of photo images from PlantNet.
Archive is 31 gigabytes and contains the main
`images` `test`, `train`, and `val` directories.
Download images from upstream, or this `rsync`, *por ahora*.
```
sudo mkdir /srv/ml
sudo chown jebba:jebba /srv/ml
mkdir -p /srv/ml/plantnet/files/
rsync -utla rsync://66.135.9.139/plantnet/files/ \
/srv/ml/plantnet/files/
```
## `nvtop`
It may be handy to have `top` for NVidia GPUs.
Works with A16 and A40, partially works with A100.
In new directory:
```
git clone https://github.com/Syllo/nvtop
cd nvtop/
mkdir build
cd build
cmake ..
ccmake ..
make -j4
# Run:
./src/nvtop
```
In the `ccmake` menu, disable all except NVidia.
2023-07-04 10:30:12 -06:00
# Run
Run thusly.
## Train Model
Train a model:
```
./train.sh [model name]
```
Example:
```
./train.sh resnet50
```
## Load Model
This repo is for training models, not using them.
But there is a script that can load each model to verify it at least
can load or not.
Edit source to test each model individually. Then run:
```
./load-model.py
```
2023-07-05 10:36:05 -06:00
# Docs
See the Libre Office spreadsheet `docs/train-plantnet.ods` for
info about each initial test run.
# Development
The `black` formatting application is used.
To install:
```
pip install -r requirements-dev.txt
```
2023-07-03 20:21:12 -06:00
# Upstream
Upstream source repository, BSD 2-Clause License.
* https://github.com/plantnet/PlantNet-300K
See `README-upstream.md` for upstream README.
# Copyright
Unofficial project, not related to PlantNet.
Upstream sources under their respective copyrights.
2023-07-05 09:46:15 -06:00
Source code license: BSD 2-Clause License.
Documentation license: Creative Commons CC by SA 4.0 International.
Data license: Creative Commons CC by SA 4.0 International.
2023-07-03 20:21:12 -06:00
*Copyright © 2023, Jeff Moe.*