Defining targets for training images
Cleaning up commit message, and formatting on files.
More details:
- Includes ability to run command-line with or without bazel
- Also has write capability to flatbuffers for multiple targets
- Definition of targets and cameras, along with 3D point calcs
- Includes camera and target helper functions, along with defaults to get started
- Modified from Brian's version to work with python target_definition code, esp. to send multiple targets.
- Getting target_defintion set up for building flatbuffer data file. Updated blue power point image to include full wings.
- Sample python code to do multiple image training, matching, and display results. Includes sample images to play with
- Adding code to define masking polygons for removing features for training
- Tools to write out the target definition to flatbuffer
- Adds multi-target definition, and automates the process
Change-Id: Ibc90d51a129751bf456da6813b3e7cbc5e55901a
diff --git a/y2020/vision/tools/python_code/BUILD b/y2020/vision/tools/python_code/BUILD
new file mode 100644
index 0000000..670b664
--- /dev/null
+++ b/y2020/vision/tools/python_code/BUILD
@@ -0,0 +1,49 @@
+load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library", "flatbuffer_py_library")
+
+py_binary(
+ name = "load_sift_training",
+ data = [
+ ":test_images/train_power_port_red.png",
+ ":test_images/train_power_port_red_webcam.png",
+ ":test_images/train_power_port_blue.png",
+ ":test_images/train_loading_bay_red.png",
+ ":test_images/train_loading_bay_blue.png",
+ ],
+ srcs = ["load_sift_training.py",
+ "camera_definition.py",
+ "define_training_data.py",
+ "target_definition.py",
+ "train_and_match.py",
+ ],
+ args = ["sift_training_data.h",
+ ],
+ default_python_version = "PY3",
+ srcs_version = "PY2AND3",
+ deps = [
+ "//y2020/vision/sift:sift_fbs_python",
+ "@opencv_contrib_nonfree_amd64//:python_opencv",
+ "@bazel_tools//tools/python/runfiles",
+ ],
+)
+
+genrule(
+ name = "run_load_sift_training",
+ outs = [
+ "sift_training_data.h",
+ ],
+ cmd = " ".join([
+ "$(location :load_sift_training)",
+ "$(location sift_training_data.h)",
+ ]),
+ tools = [
+ ":load_sift_training",
+ ],
+)
+
+cc_library(
+ name = "sift_training",
+ hdrs = [
+ "sift_training_data.h",
+ ],
+ visibility = ["//visibility:public"],
+)