1
0
Fork 0
 
 
Go to file
Jeff Moe a1615d425b Build models with hyperparams from paper 2023-07-08 08:26:11 -06:00
docs Build models with hyperparams from paper 2023-07-08 08:26:11 -06:00
images updating README with images and more links 2022-08-02 11:52:45 +02:00
.gitattributes Track LibreOffice spreadsheet with git LFS 2023-07-05 10:28:13 -06:00
.gitignore Ignore python temp files 2023-07-05 14:39:26 -06:00
LICENSE-BSD Move LICENSE to it's name 2023-07-03 20:12:29 -06:00
LICENSE-CC CC by SA 4.0 International 2023-07-05 09:46:27 -06:00
README-upstream.md Move upstream README 2023-07-03 20:11:12 -06:00
README.md Rename PlantNetLibre-300K 2023-07-05 15:48:22 -06:00
cli.py Reformat upstream python with black 2023-07-05 13:55:21 -06:00
epoch.py Reformat upstream python with black 2023-07-05 13:55:21 -06:00
load-model.py Reformat my python cruft with black 2023-07-05 13:56:42 -06:00
main.py Reformat upstream python with black 2023-07-05 13:55:21 -06:00
plantnet_300k_env.yml adding code for all models 2022-08-02 11:53:04 +02:00
requirements-dev.txt black pip requirement 2023-07-05 13:54:04 -06:00
requirements.txt pip install some requirements 2023-07-03 22:52:20 -06:00
train.py Print command to run to train 2023-07-05 18:56:39 -06:00
train.sh Quick & dirty training script 2023-07-03 20:26:07 -06:00
utils.py Reformat upstream python with black 2023-07-05 13:55:21 -06:00

README.md

PlantNet-300K Forklet

This is a forklet of the PlantNet-300K training repository.

Related repository:

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

PlantNetLibre-300K

Clone the repo and set up Python environment. Flavor Python version to taste.

git clone https://spacecruft.org/deepcrayon/PlantNetLibre-300K
cd PlantNetLibre-300K/
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
pip install -r requirements.txt

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.

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

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

Upstream

Upstream source repository, BSD 2-Clause License.

See README-upstream.md for upstream README.

Copyright

Unofficial project, not related to PlantNet. Upstream sources under their respective copyrights.

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.

Copyright © 2023, Jeff Moe.