Skip to content

Commit d8de6a1

Browse files
[update] Update
1 parent f5d4ebb commit d8de6a1

14 files changed

+9
-8
lines changed

.gitignore

100644100755
File mode changed.

CMakeLists.txt

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ project(pytorch_enet_ros)
55
add_compile_options(-std=c++11)
66

77
# Locate the cmake file of torchlib
8-
#set(Torch_DIR "/opt/pytorch/pytorch/torch/share/cmake/Torch/")
9-
set(Torch_DIR "$ENV{TORCH_ROOT}/torch/share/cmake/Torch/")
8+
set(Torch_DIR "/opt/pytorch/pytorch/torch/share/cmake/Torch/")
9+
#set(Torch_DIR "$ENV{TORCH_ROOT}/torch/share/cmake/Torch/")
1010

1111
## Find catkin macros and libraries
1212
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)

README.md

100644100755
File mode changed.

images/camvid12.png

100644100755
File mode changed.

images/greenhouse4.png

100644100755
File mode changed.

include/pytorch_cpp_wrapper/pytorch_cpp_wrapper.h

100644100755
File mode changed.

include/pytorch_enet_ros/pytorch_enet_ros.h

100644100755
File mode changed.

launch/pytorch_enet_ros.launch

100644100755
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<?xml version="1.0"?>
2-
32
<launch>
3+
<arg name="image" default="/camera/rgb/image_rect_color" />
4+
45
<node pkg="pytorch_enet_ros" type="pytorch_enet_ros_node" name="pytorch_enet_ros_node" output="screen">
56
<!--
67
<remap from="~image" to="/kinect2/qhd/image_color_rect" />
78
<param name="model_file" value="$(find pytorch_enet_ros)/models/ENet_camvid.pt" />
89
<param name="colormap" value="$(find pytorch_enet_ros)/images/camvid12.png" />
910
-->
10-
<remap from="~image" to="/camera/rgb/image_rect_color" />
11-
<param name="model_file" value="$(find pytorch_enet_ros)/models/ENet_scenes_train_c2-501_2_200.pt" />
11+
<remap from="~image" to="$(arg image)" />
12+
<param name="model_file" value="$(find pytorch_enet_ros)/models/ENet_greenhouse.pt" />
1213
<param name="colormap" value="$(find pytorch_enet_ros)/images/greenhouse4.png" />
1314
<param name="model_name" value="greenhouse" />
1415
</node>

package.xml

100644100755
File mode changed.

script/model.py

100644100755
File mode changed.

script/pytorch_enet_ros_node.py

100644100755
File mode changed.

src/pytorch_cpp_wrapper.cpp

100644100755
File mode changed.

src/pytorch_enet_ros.cpp

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ PyTorchENetROS::inference(cv::Mat & input_img)
9393
int height_orig = input_img.size().height;
9494
int width_orig = input_img.size().width;
9595

96-
// cv::Size s(320, 240);
96+
cv::Size s(480, 264);
9797
// Resize the input image
98-
// cv::resize(input_img, input_img, s);
98+
cv::resize(input_img, input_img, s);
9999

100100
// ROS_INFO("[PyTorchENetROS inference] Start");
101101
at::Tensor input_tensor;
@@ -120,7 +120,7 @@ PyTorchENetROS::inference(cv::Mat & input_img)
120120
// Set the size
121121
cv::Size s_orig(width_orig, height_orig);
122122
// Resize the input image back to the original size
123-
// cv::resize(label, label, s_orig, cv::INTER_NEAREST);
123+
cv::resize(label, label, s_orig, cv::INTER_NEAREST);
124124

125125
cv::Mat color_label;
126126
// cv::applyColorMap(mat, color_label, cv::COLORMAP_JET);

src/pytorch_enet_ros_node.cpp

100644100755
File mode changed.

0 commit comments

Comments
 (0)