title: Swift: Process UIImage data for use in Firebase custom TFLite model
body: <p>I am using Swift, Firebase, and Tensorflow to build an image recognition model. I have a re-trained MobileNet model that takes an input array of [1,224,224,3] copied into my Xcode bundle, and when I try to add data from an image as an input, I get the error: <code>Input 0 should have 602112 bytes, but found 627941 bytes.</code> I am using the following code:</p>
  
  <pre><code>    let input = ModelInputs()
      do {
          let newImage = image.resizeTo(size: CGSize(width: 224, height: 224))
  
          let data = UIImagePNGRepresentation(newImage)
  
          // Store input data in `data`
  
          // ...
          try input.addInput(data)
          // Repeat as necessary for each input index
      } catch let error as NSError {
          print("Failed to add input: \(error.localizedDescription)")
      }
  
  
  
      interpreter.run(inputs: input, options: ioOptions) { outputs, error in
          guard error == nil, let outputs = outputs else {
              print(error!.localizedDescription)//ERROR BEING CALLED HERE
              return }
          // Process outputs
          print(outputs)
          // ...
      }
  </code></pre>
  
  <p>How can I re-process the image data to be 602112 bytes? I am so confused if someone could please help me it would be great :)</p>