-
Notifications
You must be signed in to change notification settings - Fork 188
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
[jsk_perception] PeoplePoseEstimation2D #2115
Conversation
8efc53e
to
ba459c8
Compare
|
||
pose_estimated_img, people_joint_positions = self.pose_estimate(img) | ||
pose_estimated_msg = br.cv2_to_imgmsg( | ||
pose_estimated_img.astype(np.uint8)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is br.cv2_to_imgmsg(..., encoding="bgr8");
fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Fixed it
img = br.imgmsg_to_cv2(img_msg, desired_encoding='bgr8') | ||
pose_estimated_img, people_joint_positions = self.pose_estimate(img) | ||
pose_estimated_msg = br.cv2_to_imgmsg( | ||
pose_estimated_img.astype(np.uint8)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,2 @@ | |||
string[] limb_names | |||
geometry_msgs/Point32[] points |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not we use geometry_msgs/Pose
with nan rotation values ((0, 0, 0, 0) for quaternion),
expecting the future work of estimating rotation of human limbs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion!
Changed Point32 to Pose
Anyway, this is a really nice feature 🎉 |
@@ -149,7 +149,7 @@ def _cb_with_depth(self, img_msg, depth_msg, camera_info_msg): | |||
|
|||
pose_estimated_img, people_joint_positions = self.pose_estimate(img) | |||
pose_estimated_msg = br.cv2_to_imgmsg( | |||
pose_estimated_img.astype(np.uint8)) | |||
pose_estimated_img.astype(np.uint8), encoding='bgr8') | |||
pose_estimated_msg.header = img_msg.header | |||
pose_estimated_msg.encoding = "bgr8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be removed.
and same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what indicates 'this'? astype(np.int32)? encoding='bgr8'?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pose_estimated_msg.encoding = "bgr8"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
a17fe9f
to
1057a8d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great feature! I'll use and would like to give you a feedback.
Please note my comment.
</rosparam> | ||
</node> | ||
|
||
<include file="$(find opencv_apps)/launch/hsv_color_filter.launch" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iory I cannot see hsv_color_filter.launch
in this directory. Will you create another pull request to opencv_apps
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In opencv_apps repository, hsv_color_filter.launch
exists.
https://github.com/ros-perception/opencv_apps/blob/indigo/launch/hsv_color_filter.launch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, sorry, thanks. It only took a lot of time to pull this repository...
Traceback (most recent call last):
File "/home/demo/ros/indigo/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/people_pose_estimation_2d.py", line 504, in <module>
PeoplePoseEstimation2D()
File "/home/demo/ros/indigo/src/jsk-ros-pkg/jsk_common/jsk_topic_tools/src/jsk_topic_tools/transport.py", line 24, in __call__
obj = type.__call__(cls, *args, **kwargs)
File "/home/demo/ros/indigo/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/people_pose_estimation_2d.py", line 101, in __init__
self._load_model()
File "/home/demo/ros/indigo/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/people_pose_estimation_2d.py", line 109, in _load_model
self._load_chainer_model()
File "/home/demo/ros/indigo/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/people_pose_estimation_2d.py", line 115, in _load_chainer_model
self.func = pickle.load(open(model_file, 'rb'))
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1126, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute '_recover_parameter Something is wrong in detection node... |
I am using chainer v2.0.0.
https://github.com/jsk-ros-pkg/jsk_recognition/pull/2115/files#diff-ecc75cd236b801b628c0107ef250fea5R11 |
@iory Thanks a lot for advice. diff --git a/jsk_perception/node_scripts/people_pose_estimation_2d.py b/jsk_perception/node_scripts/pe
index ed23542..660e9c9 100755
--- a/jsk_perception/node_scripts/people_pose_estimation_2d.py
+++ b/jsk_perception/node_scripts/people_pose_estimation_2d.py
@@ -8,7 +8,8 @@ import pickle
import chainer
import chainer.functions as F
-import chainer.links.caffe
+# import chainer.links.caffe
+import chainer.functions.caffe
from chainer import cuda
import cv2
import matplotlib
diff --git a/jsk_perception/sample/sample_people_pose_estimation_2d.launch b/jsk_perception/sample/sam
index 76eff5d..3ef7c2e 100644
--- a/jsk_perception/sample/sample_people_pose_estimation_2d.launch
+++ b/jsk_perception/sample/sample_people_pose_estimation_2d.launch
@@ -1,7 +1,7 @@
<launch>
<arg name="gui" default="true" />
- <arg name="GPU" default="-1" />
+ <arg name="GPU" default="0" />
<arg name="INPUT_IMAGE" default="/camera/rgb/image_rect_color" />
<arg name="INPUT_DEPTH_IMAGE" default="/camera/depth_registered/hw_registered/image_rect_raw" />
<arg name="INPUT_CAMERA_INFO" default="/camera/rgb/camera_info" />
@@ -22,7 +22,7 @@
<remap from="~input/depth" to="$(arg INPUT_DEPTH_IMAGE)" />
<rosparam subst_value="true">
gpu: $(arg GPU)
- model_file: $(find jsk_perception)/trained_data/pose_estimation_2d_chainermodel.pkl
+ model_file: $(find jsk_perception)/trained_data/pose_estimation_2d_chainermodel_v1.24.pkl
with_depth: true
scales: [0.38]
stride: 8 but still no luck. [ERROR] [WallTime: 1498050794.349546] [1497924863.451970] bad callback: <bound method Subscriber.callback of <message_filters.Subscriber object at 0x7f8f101a2290>>
Traceback (most recent call last):
File "/opt/ros/indigo/lib/python2.7/dist-packages/rospy/topics.py", line 720, in _invoke_callback
cb(msg)
File "/opt/ros/indigo/lib/python2.7/dist-packages/message_filters/__init__.py", line 74, in callback
self.signalMessage(msg)
File "/opt/ros/indigo/lib/python2.7/dist-packages/message_filters/__init__.py", line 56, in signalMessage
cb(*(msg + args))
File "/opt/ros/indigo/lib/python2.7/dist-packages/message_filters/__init__.py", line 229, in add
self.signalMessage(*msgs)
File "/opt/ros/indigo/lib/python2.7/dist-packages/message_filters/__init__.py", line 56, in signalMessage
cb(*(msg + args))
File "/home/furushchev/ros/indigo/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/people_pose_estimation_2d.py", line 154, in _cb_with_depth
pose_estimated_img, people_joint_positions = self.pose_estimate(img)
File "/home/furushchev/ros/indigo/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/people_pose_estimation_2d.py", line 223, in pose_estimate
return self._pose_estimate_chainer_backend(bgr)
File "/home/furushchev/ros/indigo/src/jsk-ros-pkg/jsk_recognition/jsk_perception/node_scripts/people_pose_estimation_2d.py", line 245, in _pose_estimate_chainer_backend
outputs=['Mconv7_stage6_L2', 'Mconv7_stage6_L1'])
File "/usr/local/lib/python2.7/dist-packages/chainer/links/caffe/caffe_function.py", line 193, in __call__
output_vars = func(*input_vars)
File "/usr/local/lib/python2.7/dist-packages/chainer/links/caffe/caffe_function.py", line 569, in __call__
return self.caffe_func[self.name](*xs, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/chainer/links/connection/convolution_2d.py", line 109, in __call__
deterministic=self.deterministic)
AttributeError: 'Convolution2D' object has no attribute 'deterministic' |
With pretrained data for v1.24, it may also try to search |
It means that you cannot
|
I can import chainer.functions.caffe, that's no problem! I mean, in
self.func , chainer.links.caffe is referred.
2017年6月21日(水) 22:48 iory <notifications@github.com>:
It means that you cannot import chainer.functions.caffe?
In my environment,
In [1]: import chainer
In [2]: chainer.__version__
Out[2]: '1.24.0'
In [3]: import chainer.functions.caffe
In [4]:
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#2115 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB0B0LKordr1dN7Cj6AoVo-zkq1AbJ-Pks5sGR8tgaJpZM4N8AvY>
.
--
-- ⌘ Yuki Furuta
|
Sorry, try this pickle file. |
I try in chainer v1.24.0.
|
what is the recommended version of chainer ? can we install both v1 and v2
in same environment?
#2107
…--
◉ Kei Okada
2017-06-21 23:29 GMT+09:00 iory <notifications@github.com>:
I try in chainer v1.24.0.
We need to change a little bit code.
+++ b/jsk_perception/node_scripts/people_pose_estimation_2d.py
@@ -283,7 +283,8 @@ class PeoplePoseEstimation2D(ConnectionBasedTransport):
all_peaks[:, 1] = peaks[:, 0]
all_peaks[:, 2] = heatmap_avg[peaks.T.tolist()]
peaks_order = peaks[..., 2]
- all_peaks = all_peaks[xp.argsort(peaks_order)]
+ peaks_order = chainer.cuda.to_cpu(peaks_order)
+ all_peaks = all_peaks[np.argsort(peaks_order)]
all_peaks[:, 3] = xp.arange(peak_counter, dtype=np.float32)
if self.gpu != -1:
all_peaks = chainer.cuda.to_cpu(all_peaks)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2115 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAeG3CGPiROeGygjZ3C5BiTN89OLn7gaks5sGSi8gaJpZM4N8AvY>
.
|
In my opinion, we should install chainer v2.0.0 if possible since backward compatibility is broken, it is necessary to write the corresponding code one by one.
I do not know what 'same' means, but if we install a virtual environment such as pyenv or anaconda, we can install v1 and v2. |
@iory Thanks a lot! It now works well on chainer v1.24.0 |
[jsk_perception][people_pose_estimation_2d.py] keep compatibility for chainer v1
@wkentaro |
I prefer to remain jsk_perception independent to jsk_pcl_ros considering compilation time, so cloud you please refine the 3d processing? |
Thanks! I removed pcl dependencies. |
@furushchev |
@iory Tested on my local machine. It works well. Great Job! |
Travis passed. Could you merge this? |
Add people_pose_estimation_in_2d.