CSV to MultiArray generates grey image

I have a csv file with values ranges between 0-1. When converted this csv values to MLMultiArray and then to UIImage it shows grey image. But the image is actually coloured. So is there any step missing or do I have to perform any more action to get this image to be coloured. Sample csv values - [0.556862745 0.62745098 0.811764706]

Code

func parseCSV(data: String) -> [Float] {
            
    var finalArray = [Float]()
    
    var rows = data.components(separatedBy: "\n")

    for row in rows {
        let columns = row.components(separatedBy: ",")
        
        if columns.count == 3 {
            let r = columns[0]
            let g = columns[1]
            var b = columns[2]
            
            if b.contains("\r"){
                b = b.replacingOccurrences(of: "\r", with: "")
            }

            finalArray.append(Float(r)!)
            finalArray.append(Float(g)!)
            finalArray.append(Float(b)!)                                   
        }
    }
    
    return finalArray
}

  let m = try MLMultiArray(shape: [1, 768, 512, 3], dataType: .double)
          for (index, element) in data.enumerated() {
            m[index] = NSNumber(value: element)
        }

        let model: ModelInput = {
            do {
                let config = MLModelConfiguration()
                return try ModelInput(configuration: config)

            } catch {
                fatalError("Couldn't create Prediction model")
            }
        }()

        let op = try model.prediction(input: ModelInput(input1: m))

        let opvalue = op.featureValue(for: "Output")
        let multiArray = opvalue!.multiArrayValue!