<launch>

  <arg name="INPUT_IMAGE" />

  <arg name="gui" default="true" />
  <arg name="gpu" default="0" />

  <arg name="COCO" default="true" doc="true: COCO, false: VOC" />

  <node name="mask_rcnn_instance_segmentation"
        pkg="jsk_perception" type="mask_rcnn_instance_segmentation.py"
        clear_params="true">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <rosparam subst_value="true" if="$(arg COCO)">
      gpu: $(arg gpu)
      pretrained_model: $(find jsk_perception)/trained_data/mask_rcnn_resnet50_coco_20180730.npz
      anchor_scales: [2, 4, 8, 16, 32]
      min_size: 800
      max_size: 1333
    </rosparam>
    <rosparam ns="fg_class_names" file="$(find jsk_perception)/sample/config/coco_class_names.yaml" if="$(arg COCO)" />

    <rosparam subst_value="true" unless="$(arg COCO)">
      gpu: $(arg gpu)
      pretrained_model: $(find jsk_perception)/trained_data/mask_rcnn_resnet50_voc_20180516.npz
      anchor_scales: [4, 8, 16, 32]
      min_size: 600
      max_size: 1000
    </rosparam>
    <rosparam ns="fg_class_names" file="$(find jsk_perception)/sample/config/voc_class_names.yaml" unless="$(arg COCO)" />
  </node>

  <group if="$(arg gui)">
    <node name="tile_image"
          pkg="jsk_perception" type="tile_image.py"
          clear_params="true">
      <rosparam subst_value="true">
        input_topics:
          - $(arg INPUT_IMAGE)
          - mask_rcnn_instance_segmentation/output/viz
        draw_topic_name: true
        font_scale: 0.8
        font_thickness: 2
      </rosparam>
    </node>

    <node name="image_view"
          pkg="image_view" type="image_view"
          clear_params="true">
      <remap from="image" to="tile_image/output" />
    </node>
  </group>

</launch>
