Anno-Robot: Project Status/Docs

Paul Xiong
4 min readSep 26, 2023

--

How to run Anno-Robot step by step

Quick Start (resume from vacation)

In Mac terminal:

$ ssh -x bxiong@192.168.1.74
(Now, in remote)
$ tmux
$ . ~/start.docker.sh
$ . ~/run.docker.sh
(Now, in docker)
# . ~/run.sh
  • To run the web server + gradio:
choose 3 (/mnt/2_gradio_run)
$ ./run.sh
  • To build Gradio package:
choose 5
$ ./run.sh
then choose 2
  • To build the new training dataset
choose 4
$ ./run.sh
  • To train the new model of pix2seq:
choose 2
# ./run.sh same as following
##$ python3 run_FineTune.py

Hardware setup

Source function blocks

My simplest development env. (SWs)

Train Mode

After get into docker exciting_rhodes,

$ cd /mnt/pxi2seq/colabs
$ python3 run_FineTune.py

new model will be saved to:

|-- colabs
| |-- anno_dataset -> /mnt/anno_dataset/
| |-- obj365_pretrain
| |-- output
| |-- pix2seq
| |-- run_FineTune_tmp_imgs
| |-- test_mode_save_output

Inference

$ cd /mnt/gradio/demo/image_classifier_interpretation/
$ python3 run_Gradio.py

access gradio by http://127.0.0.1:6870

Development Enviroment Setup after Installation of Jetson SDK:

HW: 1 Jetson Xavier box + 1 TV

SW: VSCode (2)+ Docker(1…n)

  1. Installing Jetson SDK 5.0 on Xavier box, follow the another post
  2. Add root’s password:
    (by default, Ubuntu 20.22 doesn’t give root a password, which I did not find, so adding root a password is a safe play, in cause give a wrong format to sudoers, that will causes the whole system cannot run any sudo command anymore.)
$ sudo -i

3. Type your own password when prompted, and then you will see # prompt.

# passwd

typing your new password for two times.

4. Add username to root’s previlige:

$ sudo vim /etc/sudoers
# like following:
bxiong ALL=NOPASSWD:/usr/bin/docker,/usr/bin/shutdown

# Note: to shutdown/halt jetson
$ shutdown -h now
# to reboot jetson, not use reboot command?
$ shutdown -r now

5. Change the mount point of external HD: (my case, I use /mnt/docker and /mnt/data)

$ gnome-disks

6. Change /home/bxiong to /mnt/docker (we don’t want to use box flash, so changed to external usb hd).

$ sudo vim /etc/passwd
===================================
systemd-coredump:x:995:995:systemd Core Dumper:/:/usr/sbin/nologin
bxiong:x:1000:1000:bxiong,,,:/mnt/docker:/bin/bash

7. Change docker image storage root, find root in following file and change it to "data-root": "/mnt/docker"

$ sudo vim /etc/docker/daemon.json
=====================================
{
"runtimes": {
"nvidia": {
"path": "nvidia-container-runtime",
"runtimeArgs": []
}
},
"data-root": "/mnt/docker/root"
}
$ sudo service docker stop
$ sudo service docker start
$ sudo systemctl status docker.service

8. Download docker container image from nvidia: (if you only re-flash the OS image and file system image, you can pass this step.)

#tensorflow 1.15 and pytorch, etc
$ sudo docker pull nvcr.io/nvidia/l4t-ml:r34.1.0-py3

or

# tensorflow 2.8
$ sudo docker pull nvcr.io/nvidia/l4t-tensorflow:r34.1.0-tf2.8-py3

Download following project :

$ git clone https://github.com/google-research/pix2seq.git

Run container with local folder mount into it:

$ sudo docker run -it --runtime nvidia --network host -v /mnt/docker/github:/mnt 5-13-tf2.8.imgor $ sudo docker run -it --runtime nvidia --network host -v /mnt/docker/github/:/mnt nvcr.io/nvidia/l4t-tensorflow:r34.1.0-tf2.8-py3

Commit to docker image after many works on a container:

# docker commit -help can see the details.
$ sudo docker commit container_ID new-image_name

Don’t use jupyter, use VSCode with docker, Vscode is much powerful and stable.

8. To install VSCode, finding the 1.50.0:

$ wget https://update.code.visualstudio.com/1.50.0/linux-deb-arm64/stable
$ sudo dpkg -i stable
$ code

Other version won’t work with Nvidia Jetpack5.0 .

To install gradio, need to install cargo of rust:

$ curl https://sh.rustup.rs -sSf | sh

Then install gradio from pypi:

$ pip gradio

To install from source code, here is the my post. https://paulxiong.medium.com/understand-pip-install-in-gradio-open-source-e8ca1ccbd22a

Current working tree

.
|-- Auto-Annotate
| |-- asset
| `-- mrcnn
|-- anno_dataset
| |-- data (VOC dataset dw)
| `-- dummy_data
|-- convert2coco
|-- datasets (TF dataset src)
| |-- docs
| `-- tensorflow_datasets
|-- gradio
| |-- demo (gradio integ w/ pix2seq infer)
| |-- gradio.egg-info
| |-- gradio_my
| |-- guides
| |-- scripts
| |-- test
| |-- ui
| `-- website
|-- gradio_my
| `-- templates
|-- minicoco
| `-- data
|-- my_
| |-- awesome-demos
| |-- gradio
| |-- pix2seq
| `-- tmp
|-- pix2seq
| |-- STEGO
| |-- architectures
| |-- colabs (fine-tune)
| |-- configs
| |-- data
| |-- metrics
| |-- models
| |-- pix2seq
| |-- tasks
| |-- test_mode_save_output
| |-- tf-addons-bin
| `-- tmp
`-- tiny-coco
`-- small_coco
46 directories

Convert ipynvb to py or reverse

$ ipynb-py-convert in.ipynb out.py
#or
$ ipynb-py-convert in.py out.ipynb

--

--

Paul Xiong

Coding, implementing, optimizing ML annotation with self-supervised learning, TLDR: doctor’s labeling is the 1st priority for our Cervical AI project.