diff --git a/LICENSE b/image_object_detection/LICENSE similarity index 100% rename from LICENSE rename to image_object_detection/LICENSE diff --git a/README.md b/image_object_detection/README.md similarity index 100% rename from README.md rename to image_object_detection/README.md diff --git a/config/image_object_detection.yaml b/image_object_detection/config/image_object_detection.yaml similarity index 100% rename from config/image_object_detection.yaml rename to image_object_detection/config/image_object_detection.yaml diff --git a/launch/image_object_detection_launch.py b/image_object_detection/launch/image_object_detection_launch.py similarity index 100% rename from launch/image_object_detection_launch.py rename to image_object_detection/launch/image_object_detection_launch.py diff --git a/package.xml b/image_object_detection/package.xml similarity index 91% rename from package.xml rename to image_object_detection/package.xml index 4143738..3c7e08f 100644 --- a/package.xml +++ b/image_object_detection/package.xml @@ -18,8 +18,11 @@ cv_bridge image_transport vision_msgs + std_msgs + image_object_detection_msgs ament_python + diff --git a/requirements.txt b/image_object_detection/requirements.txt similarity index 100% rename from requirements.txt rename to image_object_detection/requirements.txt diff --git a/resource/image_object_detection b/image_object_detection/resource/image_object_detection similarity index 100% rename from resource/image_object_detection rename to image_object_detection/resource/image_object_detection diff --git a/resource/models b/image_object_detection/resource/models similarity index 100% rename from resource/models rename to image_object_detection/resource/models diff --git a/resource/utils b/image_object_detection/resource/utils similarity index 100% rename from resource/utils rename to image_object_detection/resource/utils diff --git a/setup.cfg b/image_object_detection/setup.cfg similarity index 100% rename from setup.cfg rename to image_object_detection/setup.cfg diff --git a/setup.py b/image_object_detection/setup.py similarity index 100% rename from setup.py rename to image_object_detection/setup.py diff --git a/src/image_object_detection/__init__.py b/image_object_detection/src/image_object_detection/__init__.py similarity index 100% rename from src/image_object_detection/__init__.py rename to image_object_detection/src/image_object_detection/__init__.py diff --git a/src/image_object_detection/image_object_detection_node.py b/image_object_detection/src/image_object_detection/image_object_detection_node.py similarity index 95% rename from src/image_object_detection/image_object_detection_node.py rename to image_object_detection/src/image_object_detection/image_object_detection_node.py index 855ddab..f327ded 100644 --- a/src/image_object_detection/image_object_detection_node.py +++ b/image_object_detection/src/image_object_detection/image_object_detection_node.py @@ -28,11 +28,12 @@ from utils.plots import plot_one_box from utils.torch_utils import select_device from vision_msgs.msg import Detection2D, Detection2DArray, ObjectHypothesisWithPose +from image_object_detection_msgs.srv import SetDetectionClasses + from ament_index_python.packages import get_package_share_directory PACKAGE_NAME = "image_object_detection" - class ImageDetectObjectNode(Node): def __init__(self): super().__init__("image_object_detection_node") @@ -112,6 +113,13 @@ def __init__(self): callback=self.set_processing_enabled_callback, ) + self.set_classes_service = self.create_service( + SetDetectionClasses, + 'set_detection_classes', + self.set_detection_classes_callback + ) + + if self.subscribers_qos == "best_effort": self.get_logger().info("Using best effort qos policy for subscribers") self.qos = QoSProfile( @@ -166,6 +174,14 @@ def __init__(self): self.initialize_model() + + def set_detection_classes_callback(self, request, response): + self.selected_detections = request.classes + self.get_logger().info(f"Updated selected_detections: {self.selected_detections}") + response.success = True + response.message = f"Successfully updated detection classes to {self.selected_detections}" + return response + def initialize_model(self): with torch.no_grad(): # Initialize diff --git a/src/image_object_detection/test_publisher.py b/image_object_detection/src/image_object_detection/test_publisher.py similarity index 100% rename from src/image_object_detection/test_publisher.py rename to image_object_detection/src/image_object_detection/test_publisher.py diff --git a/src/models/__init__.py b/image_object_detection/src/models/__init__.py similarity index 100% rename from src/models/__init__.py rename to image_object_detection/src/models/__init__.py diff --git a/src/models/common.py b/image_object_detection/src/models/common.py similarity index 100% rename from src/models/common.py rename to image_object_detection/src/models/common.py diff --git a/src/models/detect.py b/image_object_detection/src/models/detect.py similarity index 100% rename from src/models/detect.py rename to image_object_detection/src/models/detect.py diff --git a/src/models/experimental.py b/image_object_detection/src/models/experimental.py similarity index 100% rename from src/models/experimental.py rename to image_object_detection/src/models/experimental.py diff --git a/src/models/yolo.py b/image_object_detection/src/models/yolo.py similarity index 100% rename from src/models/yolo.py rename to image_object_detection/src/models/yolo.py diff --git a/src/utils/__init__.py b/image_object_detection/src/utils/__init__.py similarity index 100% rename from src/utils/__init__.py rename to image_object_detection/src/utils/__init__.py diff --git a/src/utils/activations.py b/image_object_detection/src/utils/activations.py similarity index 100% rename from src/utils/activations.py rename to image_object_detection/src/utils/activations.py diff --git a/src/utils/add_nms.py b/image_object_detection/src/utils/add_nms.py similarity index 100% rename from src/utils/add_nms.py rename to image_object_detection/src/utils/add_nms.py diff --git a/src/utils/autoanchor.py b/image_object_detection/src/utils/autoanchor.py similarity index 100% rename from src/utils/autoanchor.py rename to image_object_detection/src/utils/autoanchor.py diff --git a/src/utils/aws/__init__.py b/image_object_detection/src/utils/aws/__init__.py similarity index 100% rename from src/utils/aws/__init__.py rename to image_object_detection/src/utils/aws/__init__.py diff --git a/src/utils/aws/mime.sh b/image_object_detection/src/utils/aws/mime.sh similarity index 100% rename from src/utils/aws/mime.sh rename to image_object_detection/src/utils/aws/mime.sh diff --git a/src/utils/aws/resume.py b/image_object_detection/src/utils/aws/resume.py similarity index 100% rename from src/utils/aws/resume.py rename to image_object_detection/src/utils/aws/resume.py diff --git a/src/utils/aws/userdata.sh b/image_object_detection/src/utils/aws/userdata.sh similarity index 100% rename from src/utils/aws/userdata.sh rename to image_object_detection/src/utils/aws/userdata.sh diff --git a/src/utils/datasets.py b/image_object_detection/src/utils/datasets.py similarity index 100% rename from src/utils/datasets.py rename to image_object_detection/src/utils/datasets.py diff --git a/src/utils/general.py b/image_object_detection/src/utils/general.py similarity index 100% rename from src/utils/general.py rename to image_object_detection/src/utils/general.py diff --git a/src/utils/google_app_engine/Dockerfile b/image_object_detection/src/utils/google_app_engine/Dockerfile similarity index 100% rename from src/utils/google_app_engine/Dockerfile rename to image_object_detection/src/utils/google_app_engine/Dockerfile diff --git a/src/utils/google_app_engine/additional_requirements.txt b/image_object_detection/src/utils/google_app_engine/additional_requirements.txt similarity index 100% rename from src/utils/google_app_engine/additional_requirements.txt rename to image_object_detection/src/utils/google_app_engine/additional_requirements.txt diff --git a/src/utils/google_app_engine/app.yaml b/image_object_detection/src/utils/google_app_engine/app.yaml similarity index 100% rename from src/utils/google_app_engine/app.yaml rename to image_object_detection/src/utils/google_app_engine/app.yaml diff --git a/src/utils/google_utils.py b/image_object_detection/src/utils/google_utils.py similarity index 100% rename from src/utils/google_utils.py rename to image_object_detection/src/utils/google_utils.py diff --git a/src/utils/loss.py b/image_object_detection/src/utils/loss.py similarity index 100% rename from src/utils/loss.py rename to image_object_detection/src/utils/loss.py diff --git a/src/utils/metrics.py b/image_object_detection/src/utils/metrics.py similarity index 100% rename from src/utils/metrics.py rename to image_object_detection/src/utils/metrics.py diff --git a/src/utils/plots.py b/image_object_detection/src/utils/plots.py similarity index 100% rename from src/utils/plots.py rename to image_object_detection/src/utils/plots.py diff --git a/src/utils/torch_utils.py b/image_object_detection/src/utils/torch_utils.py similarity index 100% rename from src/utils/torch_utils.py rename to image_object_detection/src/utils/torch_utils.py diff --git a/src/utils/wandb_logging/__init__.py b/image_object_detection/src/utils/wandb_logging/__init__.py similarity index 100% rename from src/utils/wandb_logging/__init__.py rename to image_object_detection/src/utils/wandb_logging/__init__.py diff --git a/src/utils/wandb_logging/log_dataset.py b/image_object_detection/src/utils/wandb_logging/log_dataset.py similarity index 100% rename from src/utils/wandb_logging/log_dataset.py rename to image_object_detection/src/utils/wandb_logging/log_dataset.py diff --git a/src/utils/wandb_logging/wandb_utils.py b/image_object_detection/src/utils/wandb_logging/wandb_utils.py similarity index 100% rename from src/utils/wandb_logging/wandb_utils.py rename to image_object_detection/src/utils/wandb_logging/wandb_utils.py diff --git a/test/test_copyright.py b/image_object_detection/test/test_copyright.py similarity index 100% rename from test/test_copyright.py rename to image_object_detection/test/test_copyright.py diff --git a/test/test_flake8.py b/image_object_detection/test/test_flake8.py similarity index 100% rename from test/test_flake8.py rename to image_object_detection/test/test_flake8.py diff --git a/test/test_pep257.py b/image_object_detection/test/test_pep257.py similarity index 100% rename from test/test_pep257.py rename to image_object_detection/test/test_pep257.py diff --git a/yolov7-tiny.pt b/image_object_detection/yolov7-tiny.pt similarity index 100% rename from yolov7-tiny.pt rename to image_object_detection/yolov7-tiny.pt diff --git a/image_object_detection_msgs/CMakeLists.txt b/image_object_detection_msgs/CMakeLists.txt new file mode 100644 index 0000000..107bf4a --- /dev/null +++ b/image_object_detection_msgs/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.8) +project(image_object_detection_msgs) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) +find_package(rosidl_default_generators REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + "srv/SetDetectionClasses.srv" +) + +ament_export_dependencies(rosidl_default_runtime) +install( + DIRECTORY srv + DESTINATION share/${PROJECT_NAME} +) + +ament_package() \ No newline at end of file diff --git a/image_object_detection_msgs/package.xml b/image_object_detection_msgs/package.xml new file mode 100644 index 0000000..aed5890 --- /dev/null +++ b/image_object_detection_msgs/package.xml @@ -0,0 +1,18 @@ + + + + image_object_detection_msgs + 1.0.0 + Messages for image object detection + Pablo IƱigo Blasco + BSD-3-Clause + + ament_cmake + rosidl_default_generators + rosidl_default_runtime + rosidl_interface_packages + + + ament_cmake + + diff --git a/image_object_detection_msgs/srv/SetDetectionClasses.srv b/image_object_detection_msgs/srv/SetDetectionClasses.srv new file mode 100644 index 0000000..cc5e818 --- /dev/null +++ b/image_object_detection_msgs/srv/SetDetectionClasses.srv @@ -0,0 +1,4 @@ +string[] classes +--- +bool success +string message diff --git a/src/utils/wandb_logging/__pycache__/__init__.cpython-38.pyc b/src/utils/wandb_logging/__pycache__/__init__.cpython-38.pyc deleted file mode 100644 index f5eb56d..0000000 Binary files a/src/utils/wandb_logging/__pycache__/__init__.cpython-38.pyc and /dev/null differ diff --git a/src/utils/wandb_logging/__pycache__/wandb_utils.cpython-38.pyc b/src/utils/wandb_logging/__pycache__/wandb_utils.cpython-38.pyc deleted file mode 100644 index a67c720..0000000 Binary files a/src/utils/wandb_logging/__pycache__/wandb_utils.cpython-38.pyc and /dev/null differ