Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The runnable demo for reception task. #124

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
0751e37
testtesttest
Dec 5, 2023
a8f97ce
Test
Dec 5, 2023
5fe6a93
Test
Dec 5, 2023
768ad46
Message Change
Dec 6, 2023
a807b48
Merge pull request #1 from MBTMBTMBT/12_6
MBTMBTMBT Dec 6, 2023
6452c1d
fixed message writting and reading
Dec 7, 2023
5818b5e
fixed image crop
Dec 7, 2023
4ed5176
Updated the feature extraction node and changed the messages.
Dec 7, 2023
d4581c7
Merge pull request #2 from MBTMBTMBT/12_6
MBTMBTMBT Dec 7, 2023
7e3c7af
fixed that torsal and head frames were inversed.
Dec 8, 2023
4fa8ced
Merge pull request #3 from MBTMBTMBT/12_6
MBTMBTMBT Dec 8, 2023
2d88e78
Changed colour format from BGR to RGB within the detection process.
Dec 8, 2023
d4ba82c
keep the saved model
Dec 8, 2023
8f29414
keep the model file
Dec 8, 2023
8291007
keep the saved model
Dec 8, 2023
5654c3c
Cancel saving the images (but sitll cannot see use cv2.imshow)
Dec 8, 2023
9bca082
Runnable demo
Dec 11, 2023
5b034f6
added the hair colour distribution matching method
Dec 13, 2023
e19e9df
retrained model is very robust so changed the threshold
Dec 14, 2023
9343487
Moving the head to meet the person.
Jan 31, 2024
98535a0
xyz axis readable.
Feb 2, 2024
ecd469e
(Hopefully) Runnable with 3d input.
Feb 5, 2024
a4bfa70
Speak normally.
Feb 5, 2024
2a1e8d7
Try to move the head.
Feb 5, 2024
684d51b
testtesttest
Dec 5, 2023
d0c27e2
Test
Dec 5, 2023
4903409
Test
Dec 5, 2023
0dfc09a
Message Change
Dec 6, 2023
f9743ae
fixed message writting and reading
Dec 7, 2023
47ebc7c
fixed image crop
Dec 7, 2023
e8b2012
Updated the feature extraction node and changed the messages.
Dec 7, 2023
77feadb
fixed that torsal and head frames were inversed.
Dec 8, 2023
c096166
Changed colour format from BGR to RGB within the detection process.
Dec 8, 2023
67804ec
keep the saved model
Dec 8, 2023
cc860ac
keep the model file
Dec 8, 2023
8f54363
keep the saved model
Dec 8, 2023
7827dc2
Cancel saving the images (but sitll cannot see use cv2.imshow)
Dec 8, 2023
134c870
Runnable demo
Dec 11, 2023
3c6743f
added the hair colour distribution matching method
Dec 13, 2023
c1b50a5
retrained model is very robust so changed the threshold
Dec 14, 2023
2ed42a4
Moving the head to meet the person.
Jan 31, 2024
6282d2d
xyz axis readable.
Feb 2, 2024
a15a9d9
(Hopefully) Runnable with 3d input.
Feb 5, 2024
29060c0
ah
Feb 5, 2024
ef0a5f1
At least the head moves, not looking at me though.
Feb 8, 2024
205b52e
Merge branch 'LASR-at-Home:main' into main
MBTMBTMBT Feb 18, 2024
86e7a3e
Cleaned the file to have only one model appear.
Feb 23, 2024
3e384d1
Replace the old model with the new one.
Feb 23, 2024
1cb2e3b
merging
Feb 23, 2024
d66fcb3
correct the lost module.
Feb 23, 2024
aa8ec6e
info update
Feb 23, 2024
c65ccd1
fixed issues in the service
Feb 23, 2024
af28931
fixed a stupic typo
Feb 23, 2024
b91b736
runnable version for full demo
Feb 23, 2024
ae3975c
Merge branch 'main' into update-model
MBTMBTMBT Feb 23, 2024
4f78c7e
Merge pull request #4 from MBTMBTMBT/update-model
MBTMBTMBT Feb 23, 2024
d4a677a
Recover the state machine for demo.
Feb 23, 2024
7d1d84b
Added a simple loop to refresh the frame taken, should work fine.
Feb 27, 2024
8db1cb3
Cleaned some commented code.
Mar 11, 2024
5765e66
removed loading the pretrained parameters
Mar 11, 2024
dc3868e
removed load pretrained parameter.
Mar 11, 2024
703b3e8
renamed torch_module into feature_extractor (Recompile needed!!!)
Mar 11, 2024
5480abc
renamed torch_module into feature_extractor
Mar 11, 2024
109201a
renamed lasr_vision_torch to lasr_vision_feature_extraction
Mar 11, 2024
a274cdc
removed some unused code comments
Mar 11, 2024
d967c51
removed colour estimation module
Mar 11, 2024
d43e5ab
removed colour_estimation dependence
Mar 11, 2024
feb4e80
cleaned usused comments
Mar 11, 2024
d7c7a00
cleaned comments
Mar 11, 2024
4b626e9
renamed torch_module to feature_extractor
Mar 11, 2024
f5b3cda
removed unused import, launch file and functions.
Mar 11, 2024
216aba0
reset <arg name="whisper_device_param" default="9" />
Mar 11, 2024
45f8334
Remade to achieve easier bodipix model loading
Mar 22, 2024
6721361
added a break in the loop
Mar 22, 2024
0fbe28f
I don't really understand why this is in my branch, please ignore thi…
Apr 17, 2024
643bf89
Replace string return with json string return.
Apr 17, 2024
8cc1d7e
Merge pull request #5 from MBTMBTMBT/repository-clean-mar11
MBTMBTMBT Apr 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions common/helpers/colour_estimation/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions common/helpers/colour_estimation/doc/EXAMPLE.md

This file was deleted.

1 change: 0 additions & 1 deletion common/helpers/colour_estimation/doc/PREREQUISITES.md

This file was deleted.

12 changes: 0 additions & 12 deletions common/helpers/colour_estimation/doc/USAGE.md

This file was deleted.

20 changes: 0 additions & 20 deletions common/helpers/colour_estimation/src/colour_estimation/__init__.py

This file was deleted.

68 changes: 0 additions & 68 deletions common/helpers/colour_estimation/src/colour_estimation/rgb.py

This file was deleted.

39 changes: 39 additions & 0 deletions common/helpers/cv2_img/src/cv2_img/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import rospy
import numpy as np
import ros_numpy as rnp

from PIL import Image
from sensor_msgs.msg import Image as SensorImage
Expand Down Expand Up @@ -64,9 +65,47 @@ def msg_to_cv2_img(msg: SensorImage):
img = np.array(img)
img = img[:, :, ::-1].copy()

rospy.logwarn('shape of the image: ' + str(img.shape))

return img


# pcl_xyz = rnp.point_cloud2.pointcloud2_to_xyz_array(pcl_msg, remove_nans=False)
def pcl_msg_to_xyz(pcl_msg):
pcl_xyz = rnp.point_cloud2.pointcloud2_to_xyz_array(pcl_msg, remove_nans=False)

rospy.logwarn('shape of the image: ' + str(pcl_xyz.shape))

return pcl_xyz


def pcl_msg_to_cv2(pcl_msg):
"""
Constructs a cv2 image from a PointCloud2 message.

Parameters
----------
pcl_msg : sensor_msgs/PointCloud2
Input pointcloud (organised)

Returns
-------
np.array : cv2 image
"""

# Extract rgb image from pointcloud
frame = np.fromstring(pcl_msg.data, dtype=np.uint8)
frame = frame.reshape(pcl_msg.height, pcl_msg.width, 32)
frame = frame[:,:,16:19]

# Ensure array is contiguous
frame = np.ascontiguousarray(frame, dtype=np.uint8)

rospy.logwarn('shape of the image: ' + str(frame.shape))

return frame


def extract_mask_region(frame, mask, expand_x=0.5, expand_y=0.5):
"""
Extracts the face region from the image and expands the region by the specified amount.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0.2)
project(colour_estimation)
project(feature_extractor)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
Expand Down Expand Up @@ -100,7 +100,7 @@ catkin_python_setup()
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES colour_estimation
# LIBRARIES feature_extractor
# CATKIN_DEPENDS other_catkin_pkg
# DEPENDS system_lib
)
Expand All @@ -118,7 +118,7 @@ include_directories(

## Declare a C++ library
# add_library(${PROJECT_NAME}
# src/${PROJECT_NAME}/colour_estimation.cpp
# src/${PROJECT_NAME}/feature_extractor.cpp
# )

## Add cmake target dependencies of the library
Expand All @@ -129,7 +129,7 @@ include_directories(
## Declare a C++ executable
## With catkin_make all packages are built within a single CMake context
## The recommended prefix ensures that target names across packages don't collide
# add_executable(${PROJECT_NAME}_node src/colour_estimation_node.cpp)
# add_executable(${PROJECT_NAME}_node src/feature_extractor_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
Expand Down Expand Up @@ -193,7 +193,7 @@ include_directories(
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_colour_estimation.cpp)
# catkin_add_gtest(${PROJECT_NAME}-test test/test_feature_extractor.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<package format="2">
<name>colour_estimation</name>
<name>feature_extractor</name>
<version>0.0.0</version>
<description>Python utilities for estimating the name of given colours.</description>
<description>Various PyTorch helpers and utilties</description>

<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
Expand All @@ -19,13 +19,13 @@
<!-- Url tags are optional, but multiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<!-- <url type="website">http://wiki.ros.org/colour_estimation</url> -->
<!-- <url type="website">http://wiki.ros.org/feature_extractor</url> -->


<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="jane.doe@example.com">Jane Doe</author> -->
<author email="benteng.ma@kcl.ac.uk">Benteng Ma</author>


<!-- The *depend tags are used to specify dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from catkin_pkg.python_setup import generate_distutils_setup

setup_args = generate_distutils_setup(
packages=['colour_estimation'],
packages=['feature_extractor'],
package_dir={'': 'src'}
)

Expand Down
Loading