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

Qualification salvage #130

Merged
merged 90 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
f55ed47
chore: add qualification task.
jws-1 Jan 29, 2024
2dbeb21
chore: add launch file.
jws-1 Jan 29, 2024
65c630f
feat: add padding to face detections. this aids when running inferenc…
jws-1 Jan 31, 2024
2469508
feat: proper greet demo and reduce confidence for detection.
jws-1 Jan 31, 2024
6bbe24c
refactor: move create_dataset into the python package, so we can impo…
jws-1 Jan 31, 2024
0a3a237
WIP: skeleton.
jws-1 Jan 31, 2024
32e536f
data: add list of commands for database
m-barker Jan 31, 2024
df6ee5e
feat: vector db and command similarity
m-barker Jan 31, 2024
8552072
chore: catkin virtualenv.
jws-1 Feb 1, 2024
1dbfac1
chore: get faiss working.
jws-1 Feb 1, 2024
6dba695
feat: learn face service.
jws-1 Feb 1, 2024
6121e7c
fix: face learning.
jws-1 Feb 1, 2024
dbdaf38
WIP..
jws-1 Feb 1, 2024
f4a4951
chore: add sentence-transformer.
jws-1 Feb 1, 2024
54f827e
chore: update deps, python version.
jws-1 Feb 2, 2024
1e981ea
feat: add plotting of similar commands
m-barker Feb 2, 2024
c05fe30
fix(this is stupid): use the right topic.
jws-1 Feb 2, 2024
83a1f23
WIP.
jws-1 Feb 2, 2024
d176bce
chore: gitignore.
jws-1 Feb 2, 2024
46866de
feat: turning everything into actions...
jws-1 Feb 3, 2024
19dd95c
feat: debug publisher for learn_face.
jws-1 Feb 3, 2024
40801c6
fix: argparse doesn't like it when a node is launched from a launch f…
jws-1 Feb 3, 2024
a25fa01
feat: be more informative.
jws-1 Feb 3, 2024
7c1ba2e
feat: GuideAction.
jws-1 Feb 3, 2024
11ebe45
feat: add publishing of most similar images
m-barker Feb 4, 2024
1920284
feat: working GuideAction.
jws-1 Feb 3, 2024
8cb58c3
feat: publish collage similar faces
m-barker Feb 5, 2024
c60b46a
feat(WIP): look for person.
jws-1 Feb 5, 2024
b6b5998
feat: FindPerson action.
jws-1 Feb 5, 2024
fdc6b88
chore: update CMake.
jws-1 Feb 5, 2024
0496d61
feat(WIP): command loop.
jws-1 Feb 5, 2024
00a106d
feat: check for glasses
m-barker Feb 5, 2024
859adf6
Merge branch 'qualification' of github.com:LASR-at-Home/Base into qua…
m-barker Feb 5, 2024
1cf6cbe
chore: update launch.
jws-1 Feb 5, 2024
0a603e3
fix: I am an idiot.
jws-1 Feb 5, 2024
7914074
fix: moron.
jws-1 Feb 5, 2024
deb3fed
fix: cmake.
jws-1 Feb 5, 2024
e9e6226
fix: clip import error
m-barker Feb 5, 2024
ecc4f32
feat: checking for glasses working
m-barker Feb 5, 2024
98cc26c
fix: mic node conflict name
m-barker Feb 5, 2024
2d2b166
feat: just make it work.
jws-1 Feb 5, 2024
dcd80a7
feat: ReceiveObject action.
jws-1 Feb 5, 2024
43b56fd
feat: HandoverObject action, and return to default configuration.
jws-1 Feb 5, 2024
397558e
fix: use correct action.
jws-1 Feb 5, 2024
62ed573
feat: clip vqa
m-barker Feb 5, 2024
554647c
Merge branch 'qualification' of github.com:LASR-at-Home/Base into qua…
m-barker Feb 5, 2024
6586f5f
feat: raise and lower torso.
jws-1 Feb 5, 2024
ce3a99a
fix: squishing some bugs
m-barker Feb 5, 2024
baad4a5
fix: empty action
m-barker Feb 5, 2024
60c14d7
fix: disable ambient noise adjustment
m-barker Feb 5, 2024
d1eb319
feat: use laser to determine if door is closed.
jws-1 Feb 5, 2024
ef75500
chore: update launch file.
jws-1 Feb 5, 2024
047b2ff
feat: ReceiveObject and HandoverObject are working.
jws-1 Feb 6, 2024
79aabd5
feat: add speech timeout to launch
m-barker Feb 6, 2024
2499086
fix: underscore arg consistency
m-barker Feb 6, 2024
a9eb616
feat: use small model and run tf.
jws-1 Feb 6, 2024
56da298
fix: some issues with FindPerson.
jws-1 Feb 6, 2024
5de60cb
elif.
jws-1 Feb 6, 2024
59c7586
chore: use correct param.
jws-1 Feb 6, 2024
3d51b7c
feat: loop logic.
jws-1 Feb 6, 2024
1f5894d
feat: preload YOLO.
jws-1 Feb 6, 2024
5f3ab4b
fix: video changes
m-barker Feb 6, 2024
64aecdc
Just. make. it. work...
jws-1 Feb 9, 2024
974f4bf
feat: add debugging of cropped face
m-barker Feb 9, 2024
aca12a9
Just. make. it. work...
jws-1 Feb 9, 2024
fc033d3
Just. make. it. work... (2)
jws-1 Feb 9, 2024
6350e05
Just. make. it. work. (3)
jws-1 Feb 9, 2024
4bb8a9c
fix: default publisher to None.
jws-1 Feb 9, 2024
7b7068e
Merge commit '5f3ab4b6' into qualification2
jws-1 Feb 9, 2024
a82d983
feat: confidence to distance
m-barker Feb 9, 2024
dfb4735
feat: use default threshold
m-barker Feb 9, 2024
715ba0c
feat: add transcription publisher
m-barker Feb 9, 2024
1764f1a
fix: dodgy merge.
jws-1 Feb 9, 2024
fae8cdf
maybe working.
jws-1 Feb 9, 2024
c15553e
feat: last minute qualification fixes
m-barker Feb 19, 2024
e598096
chore: removing un-usable code
m-barker Feb 19, 2024
fbe2486
chore: remove more un-usable code
m-barker Feb 19, 2024
2e56625
chore: remove txt file from git keep
m-barker Feb 21, 2024
402974e
chore: tidy clip utils and move to own package
m-barker Feb 21, 2024
1678eab
chore: create faiss package
m-barker Feb 22, 2024
2253808
feat: learn face example
m-barker Feb 23, 2024
ccb6b1f
fix: handle unkown args in speech server
m-barker Feb 23, 2024
34ecfb6
feat: add example launch file for greet and identify
m-barker Feb 23, 2024
1a08b00
Apply suggestions from code review
jws-1 Feb 23, 2024
b47923f
Apply suggestions from code review
jws-1 Feb 23, 2024
a6254d0
chore: rename dir.
jws-1 Feb 23, 2024
2aa6926
chore: remove actions, update dunder init.
jws-1 Feb 23, 2024
df81cb1
chore: remove action definitions.
jws-1 Feb 23, 2024
d2fa77a
chore: gitkeeped data.
jws-1 Feb 23, 2024
209e52d
fix: CMake.
jws-1 Feb 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import torch
import actionlib
import speech_recognition as sr # type: ignore
import lasr_speech_recognition_msgs.msg # type: ignore
from std_msgs.msg import String # type: ignore
from lasr_speech_recognition_whisper import load_model # type: ignore

# Error handler to remove ALSA error messages taken from:
Expand Down Expand Up @@ -83,15 +84,17 @@ class TranscribeSpeechAction(object):

self._action_name = action_name
self._model_params = model_params

self._transcription_server = rospy.Publisher(
"/live_speech_transcription", String, queue_size=10
)
with noalsaerr():
self._model = load_model(
self._model_params.model_name,
self._model_params.device,
self._model_params.warmup,
)
# Configure the speech recogniser object and adjust for ambient noise
self.recogniser = self._configure_recogniser()
self.recogniser = self._configure_recogniser(ambient_adj=True)
# Setup the action server and register execution callback
self._action_server = actionlib.SimpleActionServer(
self._action_name,
Expand All @@ -110,6 +113,7 @@ class TranscribeSpeechAction(object):
self._action_server.start()

def _timer_cb(self, _) -> None:
return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we decide to keep it like this permanently? If so, let's just get rid of the timer altogether.

"""Adjusts the microphone for ambient noise, unless the action server is listening."""
if self._listening:
return
Expand Down Expand Up @@ -223,7 +227,7 @@ class TranscribeSpeechAction(object):
rospy.loginfo(
f"Time taken: {transcription_end_time - transcription_start_time:.2f}s"
)

self._transcription_server.publish(phrase)
if self._action_server.is_preempt_requested():
self._listening = False
return
Expand All @@ -248,13 +252,13 @@ def parse_args() -> dict:
)

parser.add_argument(
"--action-name",
"--action_name",
type=str,
default="transcribe_speech",
help="Name of the action server.",
)
parser.add_argument(
"--model-name",
"--model_name",
type=str,
default="medium.en",
help="Name of the speech recognition model.",
Expand Down Expand Up @@ -300,8 +304,8 @@ def parse_args() -> dict:
action="store_true",
help="Disable warming up the model by running inference on a test file.",
)

return vars(parser.parse_args())
args, unknown = parser.parse_known_args()
return vars(args)


def configure_model_params(config: dict) -> speech_model_params:
Expand Down Expand Up @@ -346,6 +350,8 @@ def configure_whisper_cache() -> None:
if __name__ == "__main__":
configure_whisper_cache()
config = parse_args()
rospy.init_node(config["action_name"])
server = TranscribeSpeechAction(rospy.get_name(), configure_model_params(config))
rospy.init_node("speech_transcription_node")
server = TranscribeSpeechAction(
config["action_name"], configure_model_params(config)
)
rospy.spin()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data/**
!data/.gitkeep
216 changes: 216 additions & 0 deletions common/vector_databases/lasr_vector_databases_faiss/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
cmake_minimum_required(VERSION 3.0.2)
project(lasr_vector_databases_faiss)

## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED catkin_virtualenv)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
catkin_python_setup()
catkin_generate_virtualenv(
INPUT_REQUIREMENTS requirements.in
PYTHON_INTERPRETER python3.9
)
################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a exec_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
# add_message_files(
# FILES
# Message1.msg
# Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

# Generate actions in the 'action' folder
# add_action_files(
# DIRECTORY action
# FILES WaitGreet.action Identify.action Greet.action GetName.action LearnFace.action GetCommand.action Guide.action DetectPeople.action FindPerson.action ReceiveObject.action HandoverObject.action
# )

# Generate added messages and services with any dependencies listed here
# generate_messages(
# DEPENDENCIES
# actionlib_msgs
# geometry_msgs
# )

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if your package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES qualification
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${catkin_INCLUDE_DIRS}
)

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

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## 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/qualification_node.cpp)

## Rename C++ executable without prefix
## The above recommended prefix causes long target names, the following renames the
## target back to the shorter version for ease of user use
## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")

## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
# ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# catkin_install_python(PROGRAMS
# nodes/qualification
# nodes/actions/wait_greet
# nodes/actions/identify
# nodes/actions/greet
# nodes/actions/get_name
# nodes/actions/learn_face
# nodes/actions/get_command
# nodes/actions/guide
# nodes/actions/find_person
# nodes/actions/detect_people
# nodes/actions/receive_object
# nodes/actions/handover_object
# nodes/better_qualification
# DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
# install(TARGETS ${PROJECT_NAME}_node
# RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark libraries for installation
## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
# install(TARGETS ${PROJECT_NAME}
# ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
# RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
# DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
# FILES_MATCHING PATTERN "*.h"
# PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
# # myfile1
# # myfile2
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_qualification.cpp)
# if(TARGET ${PROJECT_NAME}-test)
# target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)
Empty file.
58 changes: 58 additions & 0 deletions common/vector_databases/lasr_vector_databases_faiss/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0"?>
<package format="2">
<name>lasr_vector_databases_faiss</name>
<version>0.0.0</version>
<description>The faiss package</description>

<!-- One maintainer tag required, multiple allowed, one person per tag -->
<!-- Example: -->
<!-- <maintainer email="[email protected]">Jane Doe</maintainer> -->
<maintainer email="[email protected]">Matt Barker</maintainer>


<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>MIT</license>


<!-- 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/qualification</url> -->


<!-- Author tags are optional, multiple are allowed, one per tag -->
<!-- Authors do not have to be maintainers, but could be -->
<!-- Example: -->
<!-- <author email="[email protected]">Jane Doe</author> -->


<!-- The *depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use depend as a shortcut for packages that are both build and exec dependencies -->
<!-- <depend>roscpp</depend> -->
<!-- Note that this is equivalent to the following: -->
<!-- <build_depend>roscpp</build_depend> -->
<!-- <exec_depend>roscpp</exec_depend> -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use build_export_depend for packages you need in order to build against this package: -->
<!-- <build_export_depend>message_generation</build_export_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use exec_depend for packages you need at runtime: -->
<!-- <exec_depend>message_runtime</exec_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<!-- Use doc_depend for packages you need only for building documentation: -->
<!-- <doc_depend>doxygen</doc_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>catkin_virtualenv</build_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- Other tools can request additional information be placed here -->
<pip_requirements>requirements.txt</pip_requirements>
</export>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
faiss-cpu
Loading
Loading