Skip to content

Commit

Permalink
Use resource_retriever for weight files
Browse files Browse the repository at this point in the history
This allows using any url format that resource_retriever understands,
particularly `package://` URLs, so it becomes possible to load weight
files from other packages than `dope`.
  • Loading branch information
mintar committed Jun 19, 2019
1 parent ac61792 commit c63f92c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ find_package(catkin REQUIRED COMPONENTS
cv_bridge
geometry_msgs
message_filters
resource_retriever
rospy
sensor_msgs
std_msgs
Expand Down
19 changes: 9 additions & 10 deletions config/config_pose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ downscale_height: 500 # if the input image is larger than this, scale it do

# Comment any of these lines to prevent detection / pose estimation of that object
weights: {
"cracker":"cracker_60.pth",
"gelatin":"gelatin_60.pth",
"meat":"meat_20.pth",
"mustard":"mustard_60.pth",
"soup":"soup_60.pth",
"sugar":"sugar_60.pth",
"bleach":"bleach_28_dr.pth"
# "cracker":"package://dope/weights/cracker_60.pth",
# "gelatin":"package://dope/weights/gelatin_60.pth",
# "meat":"package://dope/weights/meat_20.pth",
# "mustard":"package://dope/weights/mustard_60.pth",
"soup":"package://dope/weights/soup_60.pth",
#"sugar":"package://dope/weights/sugar_60.pth"
# "bleach":"package://dope/weights/bleach_28_dr.pth"
}

# Cuboid dimension in cm x,y,z
Expand All @@ -23,8 +23,8 @@ dimensions: {
"mustard": [9.6024150848388672,19.130100250244141,5.824894905090332],
"soup": [6.7659378051757813,10.185500144958496,6.771425724029541],
"sugar": [9.267730712890625,17.625339508056641,4.5134143829345703],
"bleach": [10.267730712890625,26.625339508056641,7.5134143829345703]
}
"bleach": [10.267730712890625,26.625339508056641,7.5134143829345703],
}

class_ids: {
"cracker": 1,
Expand All @@ -44,7 +44,6 @@ draw_colors: {
"soup": [255, 101, 0], # orange
"sugar": [232, 222, 12], # yellow
"bleach": [232, 222, 12], # yellow

}

# optional: if you provide a mesh of the object here, a mesh marker will be
Expand Down
4 changes: 2 additions & 2 deletions nodes/dope
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ from __future__ import print_function
import cv2
import message_filters
import numpy as np
import resource_retriever
import rospkg
import rospy
import yaml
Expand Down Expand Up @@ -119,12 +120,11 @@ class DopeNode(object):
self.config_detect.thresh_points = params["thresh_points"]

# For each object to detect, load network model, create PNP solver, and start ROS publishers
path2package = rospkg.RosPack().get_path('dope')
for model in params['weights']:
self.models[model] = \
ModelData(
model,
path2package + "/weights/" + params['weights'][model]
resource_retriever.get_filename(params['weights'][model], use_protocol=False)
)
self.models[model].load_net_model()

Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<depend>geometry_msgs</depend>
<depend>message_filters</depend>
<depend>python-argparse</depend>
<depend>resource_retriever</depend>
<depend>rospy</depend>
<depend>sensor_msgs</depend>
<depend>std_msgs</depend>
Expand Down

0 comments on commit c63f92c

Please sign in to comment.