From e30cb0a508c51e5c810b3d1d5451090f6970360e Mon Sep 17 00:00:00 2001 From: Anton Tetov <anton@tetov.se> Date: Mon, 13 Jun 2022 22:44:04 +0200 Subject: [PATCH] new dir setup for imgs and logs --- .gitignore | 5 +++++ Makefile | 6 +++++- README.md | 30 +++++++++++++++++++++--------- log/.gitkeep | 0 pyproject.toml | 2 +- src/farmbot_yolo/__init__.py | 4 +++- tmp/.gitkeep | 0 7 files changed, 35 insertions(+), 12 deletions(-) create mode 100644 log/.gitkeep create mode 100644 tmp/.gitkeep diff --git a/.gitignore b/.gitignore index 4c88b41..123b4ae 100644 --- a/.gitignore +++ b/.gitignore @@ -144,3 +144,8 @@ cython_debug/ # custom creds.py creds.json +tmp/* +!tmp/.gitkeep +*.log +log/* +!log/.gitkeep diff --git a/Makefile b/Makefile index 8c613cd..6e50c1f 100644 --- a/Makefile +++ b/Makefile @@ -8,5 +8,9 @@ darknet: default: darknet $(MAKE) LIBSO=$(LIBSO) -C darknet + +clean: + rm -rf ./tmp/* + rm ./log/*.log -.PHONY: default darknet +.PHONY: default darknet clean diff --git a/README.md b/README.md index f41979e..037c3c6 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ will ensure libdarknet.so be generated, which will be used in darknet.py. ## Before starting the system **Always calibrate the position before using!** + The purpose is to reset the zero positions of x, y, z axis. This step should be done manually first and then use the webapp, i.e., the user should push the grantry and z axis to the upper right corner. Check the [official @@ -94,6 +95,11 @@ for how to use the web app to set zeros. ## How to run this system? +There is a main entrypoint, callable using `python -m farmbot_yolo` for a +complete workflow. By running it, you can make Farmbot automatically conduct the +whole process. The three modules can also be run separately, mostly for +debugging purpose. + The software has three main modules: 1. `move`: drive FarmBot to move, take photos, and open/close the gripper @@ -101,32 +107,38 @@ The software has three main modules: bounding boxes 3. `location`: input bounding boxes, transfer to real-world coordinate -We also provide `main.py` as a wrapper for all the modules above. By running it, -you can make Farmbot automatically conduct the whole process. The three modules -can also be run separately, mostly for debugging purpose. - First go to `farmbot_yolo` and `conda activate <env>` to run the following scripts. -`<env>` is the same as the one you created in _Install, Compile_ +`<env>` is the same as the one you created in [Setup](#setup) ### Move Farmbot, take photos, and open/close the gripper +TODO: Add the arguments. + +```bash +python -m farmbot_yolo ... +``` + ### YOLO detection All the arguments for file path are set to default. ``` -python farmbot_yolo.detect --dont_show --ext_output --save_labels --input ../img --weights ../weights/yolov3-vattenhallen_best.weights --config_file ../cfg/yolov3-vattenhallen-test.cfg --data_file ../data/vattenhallen.data +python -m farmbot_yolo.detect --ext_output --save_labels --input ../img --weights ../weights/yolov3-vattenhallen_best.weights --config_file ../cfg/yolov3-vattenhallen-test.cfg --data_file ../data/vattenhallen.data ``` ### Calculate location ``` -python farmbot_yolo.location -v -cam ../static/camera_no_distortion.mat -loc ../img/locations/ -a ../img/annotations -o ../static/distance.txt -l ../log/location.log +python -m farmbot_yolo.location -v -cam ../static/camera_no_distortion.mat -loc ../img/locations/ -a ../img/annotations -o ../static/distance.txt -l ../log/location.log ``` All the arguments has default values, which means they can be all omitted if you don't change the document tree structure. -### Scan the bed and pick +### Download pictures -重新生成 requirement!! +Pictures that are taken using the web ui or from the code can be downloaded using: + +```bash +python -m farmbot_yolo.download +``` diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index d4221ab..a94d26e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ authors = [ classifiers = [ "Programming Language :: Python :: 3", ] -requires-python = ">=3.8" +requires-python = ">=3.7" dependencies = [ "requests", "numpy", diff --git a/src/farmbot_yolo/__init__.py b/src/farmbot_yolo/__init__.py index e5e182d..3a3c882 100644 --- a/src/farmbot_yolo/__init__.py +++ b/src/farmbot_yolo/__init__.py @@ -1,6 +1,8 @@ from pathlib import Path HERE = Path(__file__).parent -REPO = HERE.parent +REPO = HERE.parent.parent +TMPDIR = REPO / "tmp" +LOGDIR = REPO / "log" CREDS_PATH = REPO / "creds.json" diff --git a/tmp/.gitkeep b/tmp/.gitkeep new file mode 100644 index 0000000..e69de29 -- GitLab