<launch>

  <arg name="gui" default="true" />
  <arg name="gpu" default="-1" />

  <node name="image_publisher"
        pkg="jsk_perception" type="image_publisher.py">
    <rosparam subst_value="true">
      file_name: $(find jsk_perception)/sample/image/laugh_out_loud_joke_book.jpg
      publish_info: false
      encoding: bgr8
    </rosparam>
  </node>
  <arg name="INPUT_IMAGE" default="image_publisher/output" />

  <node name="mask_publisher"
        pkg="jsk_perception" type="image_publisher.py">
    <rosparam subst_value="true">
      file_name: $(find jsk_perception)/sample/image/laugh_out_loud_joke_book_mask.jpg
      publish_info: false
      encoding: mono8
    </rosparam>
  </node>
  <arg name="MASK_IMAGE" default="mask_publisher/output" />

  <node name="apply_mask_image"
        pkg="jsk_perception" type="apply_mask_image">
    <remap from="~input" to="$(arg INPUT_IMAGE)" />
    <remap from="~input/mask" to="$(arg MASK_IMAGE)" />
    <rosparam>
      approximate_sync: true
    </rosparam>
  </node>

  <rosparam>
    target_names:
      - background
      - champion_copper_plus_spark_plug
      - cheezit_big_original
      - crayola_64_ct
      - dr_browns_bottle_brush
      - elmers_washable_no_run_school_glue
      - expo_dry_erase_board_eraser
      - feline_greenies_dental_treats
      - first_years_take_and_toss_straw_cup
      - genuine_joe_plastic_stir_sticks
      - highland_6539_self_stick_notes
      - kong_air_dog_squeakair_tennis_ball
      - kong_duck_dog_toy
      - kong_sitting_frog_dog_toy
      - kyjen_squeakin_eggs_plush_puppies
      - laugh_out_loud_joke_book
      - mark_twain_huckleberry_finn
      - mead_index_cards
      - mommys_helper_outlet_plugs
      - munchkin_white_hot_duck_bath_toy
      - oreo_mega_stuf
      - paper_mate_12_count_mirado_black_warrior
      - rolodex_jumbo_pencil_cup
      - safety_works_safety_glasses
      - sharpie_accent_tank_style_highlighters
      - stanley_66_052
  </rosparam>

  <node name="vgg16_object_recognition"
        pkg="jsk_perception" type="vgg16_object_recognition.py">
    <remap from="~input" to="apply_mask_image/output" />
    <rosparam subst_value="true">
      gpu: $(arg gpu)
      model_name: vgg16_batch_normalization
      model_file: $(find jsk_perception)/trained_data/vgg16_bn_apc2015_496000.chainermodel
    </rosparam>
    <remap from="~target_names" to="target_names" />
  </node>

  <node name="vgg16_object_recognition_masked"
        pkg="jsk_perception" type="vgg16_object_recognition.py">
    <remap from="~input" to="apply_mask_image/output" />
    <remap from="~input/mask" to="apply_mask_image/output/mask" />
    <rosparam subst_value="true">
      use_mask: true
      approximate_sync: true
      gpu: $(arg gpu)
      model_name: vgg16_batch_normalization
      model_file: $(find jsk_perception)/trained_data/vgg16_bn_apc2015_496000.chainermodel
    </rosparam>
    <remap from="~target_names" to="target_names" />
  </node>

  <node name="draw_classification_result"
        pkg="jsk_perception" type="draw_classification_result.py">
    <remap from="~input" to="vgg16_object_recognition/output" />
    <remap from="~input/image" to="$(arg INPUT_IMAGE)" />
  </node>
  <node name="draw_classification_result_masked"
        pkg="jsk_perception" type="draw_classification_result.py">
    <remap from="~input" to="vgg16_object_recognition_masked/output" />
    <remap from="~input/image" to="$(arg INPUT_IMAGE)" />
  </node>

  <group if="$(arg gui)">
    <node name="image_view0"
          pkg="image_view" type="image_view">
      <remap from="image" to="draw_classification_result/output" />
    </node>
    <node name="image_view1"
          pkg="image_view" type="image_view">
      <remap from="image" to="vgg16_object_recognition/debug/net_input" />
    </node>
    <node name="image_view2"
          pkg="image_view" type="image_view">
      <remap from="image" to="draw_classification_result_masked/output" />
    </node>
    <node name="image_view3"
          pkg="image_view" type="image_view">
      <remap from="image" to="vgg16_object_recognition_masked/debug/net_input" />
    </node>
  </group>

</launch>
