Meaning of Tensorflow Object Detection API image_additional_channels












1















I would like to use the Tensorflow Object Detection API for multi-channel images (e.g., 4-channels RGB + infrared). There is a tutorial how to change the API to add additional channels. However, the tutorial was written a year ago and the API has evolved since then and it seems that the API may accept multi-channel images now.



For example, in tensorflow-models/research/object-detection/data_decoders/tf_example_decoder.py in addition to fields.InputDataFields.image there is now fields.InputDataFields.image_additional_channels. Can it be used for any additional channels one has in an input image beyond standard 3 channels fed into fields.InputDataFields.image? I cannot figure out the purpose of this image_additional_channels and how to use it.



More general, my question is how to use the Tensorflow Object Detection API for multi-channel (>3) images. Are they accepted, i.e. taken into account, by default? I can feed them to train a model, but for inference in object_detection_tutorial notebook it cannot accept more than 3 channels, which makes me wonder whether it ignores the 4th channels during training.



I am using Tensorflow 1.12.0, latest commit (7a75bfc) of the Object Detection API. image_additional_channels was added in commit 9fce9c6 on 6 June 2018










share|improve this question



























    1















    I would like to use the Tensorflow Object Detection API for multi-channel images (e.g., 4-channels RGB + infrared). There is a tutorial how to change the API to add additional channels. However, the tutorial was written a year ago and the API has evolved since then and it seems that the API may accept multi-channel images now.



    For example, in tensorflow-models/research/object-detection/data_decoders/tf_example_decoder.py in addition to fields.InputDataFields.image there is now fields.InputDataFields.image_additional_channels. Can it be used for any additional channels one has in an input image beyond standard 3 channels fed into fields.InputDataFields.image? I cannot figure out the purpose of this image_additional_channels and how to use it.



    More general, my question is how to use the Tensorflow Object Detection API for multi-channel (>3) images. Are they accepted, i.e. taken into account, by default? I can feed them to train a model, but for inference in object_detection_tutorial notebook it cannot accept more than 3 channels, which makes me wonder whether it ignores the 4th channels during training.



    I am using Tensorflow 1.12.0, latest commit (7a75bfc) of the Object Detection API. image_additional_channels was added in commit 9fce9c6 on 6 June 2018










    share|improve this question

























      1












      1








      1


      1






      I would like to use the Tensorflow Object Detection API for multi-channel images (e.g., 4-channels RGB + infrared). There is a tutorial how to change the API to add additional channels. However, the tutorial was written a year ago and the API has evolved since then and it seems that the API may accept multi-channel images now.



      For example, in tensorflow-models/research/object-detection/data_decoders/tf_example_decoder.py in addition to fields.InputDataFields.image there is now fields.InputDataFields.image_additional_channels. Can it be used for any additional channels one has in an input image beyond standard 3 channels fed into fields.InputDataFields.image? I cannot figure out the purpose of this image_additional_channels and how to use it.



      More general, my question is how to use the Tensorflow Object Detection API for multi-channel (>3) images. Are they accepted, i.e. taken into account, by default? I can feed them to train a model, but for inference in object_detection_tutorial notebook it cannot accept more than 3 channels, which makes me wonder whether it ignores the 4th channels during training.



      I am using Tensorflow 1.12.0, latest commit (7a75bfc) of the Object Detection API. image_additional_channels was added in commit 9fce9c6 on 6 June 2018










      share|improve this question














      I would like to use the Tensorflow Object Detection API for multi-channel images (e.g., 4-channels RGB + infrared). There is a tutorial how to change the API to add additional channels. However, the tutorial was written a year ago and the API has evolved since then and it seems that the API may accept multi-channel images now.



      For example, in tensorflow-models/research/object-detection/data_decoders/tf_example_decoder.py in addition to fields.InputDataFields.image there is now fields.InputDataFields.image_additional_channels. Can it be used for any additional channels one has in an input image beyond standard 3 channels fed into fields.InputDataFields.image? I cannot figure out the purpose of this image_additional_channels and how to use it.



      More general, my question is how to use the Tensorflow Object Detection API for multi-channel (>3) images. Are they accepted, i.e. taken into account, by default? I can feed them to train a model, but for inference in object_detection_tutorial notebook it cannot accept more than 3 channels, which makes me wonder whether it ignores the 4th channels during training.



      I am using Tensorflow 1.12.0, latest commit (7a75bfc) of the Object Detection API. image_additional_channels was added in commit 9fce9c6 on 6 June 2018







      tensorflow object-detection object-detection-api satellite-image






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 12:16









      ihohoihoho

      84




      84
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I'm trying do the same thing. It seems to accept additional channels during training (you need to add them during the creation of your TfExample file(s)). You also need to set num_additional_channels in the train_input_reader portion of the pipeline config file to be the number of channels you've added.



          However, the script for exporting the model for inference does not seem to support exporting the model in a way that allows it to accept additional channels.



          As you can see here: https://github.com/tensorflow/models/blob/master/research/object_detection/exporter.py#L129



          The input tensor is only a standard image tensor and the tensor_dict[fields.InputDataFields.image_additional_channels] is not included in the input.



          I'm about to fix this for my project, so I'll try to open a pull request and get them to merge it in.






          share|improve this answer


























          • Oh, great somebody works on this as well. If you could share your fix for inference, that would be great (I guess pull request can take a while to be accepted). In terms of training, for TFRecord generation I am following this example. Would it read additional channels by default? Have you checked somehow that during training it actually takes into account any of additional channels?

            – ihoho
            Dec 12 '18 at 16:15













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392807%2fmeaning-of-tensorflow-object-detection-api-image-additional-channels%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I'm trying do the same thing. It seems to accept additional channels during training (you need to add them during the creation of your TfExample file(s)). You also need to set num_additional_channels in the train_input_reader portion of the pipeline config file to be the number of channels you've added.



          However, the script for exporting the model for inference does not seem to support exporting the model in a way that allows it to accept additional channels.



          As you can see here: https://github.com/tensorflow/models/blob/master/research/object_detection/exporter.py#L129



          The input tensor is only a standard image tensor and the tensor_dict[fields.InputDataFields.image_additional_channels] is not included in the input.



          I'm about to fix this for my project, so I'll try to open a pull request and get them to merge it in.






          share|improve this answer


























          • Oh, great somebody works on this as well. If you could share your fix for inference, that would be great (I guess pull request can take a while to be accepted). In terms of training, for TFRecord generation I am following this example. Would it read additional channels by default? Have you checked somehow that during training it actually takes into account any of additional channels?

            – ihoho
            Dec 12 '18 at 16:15


















          0














          I'm trying do the same thing. It seems to accept additional channels during training (you need to add them during the creation of your TfExample file(s)). You also need to set num_additional_channels in the train_input_reader portion of the pipeline config file to be the number of channels you've added.



          However, the script for exporting the model for inference does not seem to support exporting the model in a way that allows it to accept additional channels.



          As you can see here: https://github.com/tensorflow/models/blob/master/research/object_detection/exporter.py#L129



          The input tensor is only a standard image tensor and the tensor_dict[fields.InputDataFields.image_additional_channels] is not included in the input.



          I'm about to fix this for my project, so I'll try to open a pull request and get them to merge it in.






          share|improve this answer


























          • Oh, great somebody works on this as well. If you could share your fix for inference, that would be great (I guess pull request can take a while to be accepted). In terms of training, for TFRecord generation I am following this example. Would it read additional channels by default? Have you checked somehow that during training it actually takes into account any of additional channels?

            – ihoho
            Dec 12 '18 at 16:15
















          0












          0








          0







          I'm trying do the same thing. It seems to accept additional channels during training (you need to add them during the creation of your TfExample file(s)). You also need to set num_additional_channels in the train_input_reader portion of the pipeline config file to be the number of channels you've added.



          However, the script for exporting the model for inference does not seem to support exporting the model in a way that allows it to accept additional channels.



          As you can see here: https://github.com/tensorflow/models/blob/master/research/object_detection/exporter.py#L129



          The input tensor is only a standard image tensor and the tensor_dict[fields.InputDataFields.image_additional_channels] is not included in the input.



          I'm about to fix this for my project, so I'll try to open a pull request and get them to merge it in.






          share|improve this answer















          I'm trying do the same thing. It seems to accept additional channels during training (you need to add them during the creation of your TfExample file(s)). You also need to set num_additional_channels in the train_input_reader portion of the pipeline config file to be the number of channels you've added.



          However, the script for exporting the model for inference does not seem to support exporting the model in a way that allows it to accept additional channels.



          As you can see here: https://github.com/tensorflow/models/blob/master/research/object_detection/exporter.py#L129



          The input tensor is only a standard image tensor and the tensor_dict[fields.InputDataFields.image_additional_channels] is not included in the input.



          I'm about to fix this for my project, so I'll try to open a pull request and get them to merge it in.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 11 '18 at 14:18

























          answered Dec 11 '18 at 14:00









          static416static416

          8641720




          8641720













          • Oh, great somebody works on this as well. If you could share your fix for inference, that would be great (I guess pull request can take a while to be accepted). In terms of training, for TFRecord generation I am following this example. Would it read additional channels by default? Have you checked somehow that during training it actually takes into account any of additional channels?

            – ihoho
            Dec 12 '18 at 16:15





















          • Oh, great somebody works on this as well. If you could share your fix for inference, that would be great (I guess pull request can take a while to be accepted). In terms of training, for TFRecord generation I am following this example. Would it read additional channels by default? Have you checked somehow that during training it actually takes into account any of additional channels?

            – ihoho
            Dec 12 '18 at 16:15



















          Oh, great somebody works on this as well. If you could share your fix for inference, that would be great (I guess pull request can take a while to be accepted). In terms of training, for TFRecord generation I am following this example. Would it read additional channels by default? Have you checked somehow that during training it actually takes into account any of additional channels?

          – ihoho
          Dec 12 '18 at 16:15







          Oh, great somebody works on this as well. If you could share your fix for inference, that would be great (I guess pull request can take a while to be accepted). In terms of training, for TFRecord generation I am following this example. Would it read additional channels by default? Have you checked somehow that during training it actually takes into account any of additional channels?

          – ihoho
          Dec 12 '18 at 16:15






















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392807%2fmeaning-of-tensorflow-object-detection-api-image-additional-channels%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word