• Is it possible to change the input video/image size of the model?

I have a question about applying a person detection model to OAK-1-LITE. I downloaded and ran the inference model in openVINO using blobconverter. (blobconverter -zn xxxx) Each model in openVINO seems to have an input size that it can accept. If this is not correct, inference cannot be performed because a message like 'Input image (123x456) does not match NN (345x678)' appears.

However, I am curious if the input size of the model in the "link" can change. When I downloaded and ran the person-detection-retail-0013 model, it accepts an input size of 544x320, but it seems that the size is larger in the video than 544x320.

Is there any way to use the model with a different input size other than the specified input size? Or is the inference result in the video enlarged for display purposes?

  • erik replied to this.

    Hi june ,
    Unfortunately no, NN models require fixed input size, so you'd need to retrain/reconvert the model with that specific input size you'd want beforehand. Thoughts?
    Thanks, Erik

    By any chance, reconvert means the process of converting a model (such as tensorflow2) into blob form?

    • erik replied to this.

      Hi june ,
      Yes, if TF2 allows specifying model input afterward (post training), then that would work.
      Thanks, Erik

      1. Can you provide me with a link that I can refer to for changing the input size? I actually attempted to convert a TensorFlow 2 model to a blob type without changing the input size before, but it failed.

      2. I have a new question. Currently, I am trying to create a code that takes pictures using the still function instead of videos for inference. However, I need to modify the picture taken in the middle (resize + concatenating with other images).

        The current node flow is [ColorCamera - ImageManip - Neural network], and I used initialConfig.setResize and np.concatenate() in the ImageManip node for image modification.
        I think I made an image using np.concatenate(), but I don't know how to transfer this image to the Neueral network.
        Can I get some help on the technical aspect?


        ====


        I just read what's written here.
        All the methods in the link seem to use SDK. Is there any way to use the methods in the link as API?

        Hi june ,

        1. https://pyimagesearch.com/2019/06/24/change-input-shape-dimensions-for-fine-tuning-with-keras/ try with this tutorial, but it really depends on the model. Usually you would lose some accuracy if you change the input size.

        2. I guess a script node would be a better option, but you are going to have to hardcode your functions for concatenation since there is no numpy (ref). Your pipeline would the be [ColorCamera - ImageManip - Script - Neural network].

        Thoughts on the approach?

        Regards,
        Jaka

        1. Thanks, I'll try

        2. Is there a reason why a script needs to be put in the middle? Is there any reason to link directly from ImageManip to the Neural Network?

        3. It could be a question related to number 2, but I'm not sure, so I'm separating it.
        I'm currently making an inference code using still , but I got the following error message.
        "Input tensor 'data' (0) exceeds available data range. Data size (xxxxxB), tensor offset (0), size (xxxxxxB) - skipping inference"
        The pipeline of my code is as follows. (In order)
        (1) cam control : node for giving still signal
        (2) color cam
        (3) imagemanip: A node to fit the model input size. used setResizeThumbnail
        (4) Neural Network: Used mobilenetSSD provided by default (not changed in tutorial)
        (5) xout

        Experimentally, when I ran the code without NN, it ran fine. However, when I run it including the NN node, I get an error message, but I don't know how to solve it. can i get some help?

          Hi june
          2.Image manip doesn't support image concatenation afaik. This is why you use a script node; it gives you more flexibility.

          1. This error is usually due to mismatching types. Check what your NN expects and what your inputs are (FP16 or UINT8).

          Hope this helps,
          Jaka