diff --git a/.gitignore b/.gitignore index 4c88b418a46a7390e55d68494774fdec0f767e66..123b4aeb460c165da3085e4f912741e20df12fe9 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 8c613cd2285167d70ff8c28fedfa4d22848d3129..6e50c1fbec9a32fec0c50cdade3afd2e814ed1b8 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 f41979e081b658220547c68d932993c64e6b13e0..037c3c6bbd46dcffca927bcd52e4f0a93dd50607 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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/pyproject.toml b/pyproject.toml index d4221ab736068c96608067d54e271d88386af3f0..a94d26e536f661a1ff4823056be02756669bb68f 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 e5e182d25dd041b7a6ade7e7367f6a642e15ea35..3a3c88204e07cb6468b026c3480fc9d1941f77b6 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 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391