PINTO0309 / PINTO_model_zoo

A repository for storing models that have been inter-converted between various frameworks. Supported frameworks are TensorFlow, PyTorch, ONNX, OpenVINO, TFJS, TFTRT, TensorFlowLite (Float32/16/INT8), EdgeTPU, CoreML.
https://qiita.com/PINTO
MIT License
3.59k stars 572 forks source link

How to achieve proper CoreML model end result? #287

Closed ioskevinshah closed 2 years ago

ioskevinshah commented 2 years ago

Issue Type

Support, Documentation Feature Request

OS

Mac OS, Other

OS architecture

x86_64, aarch64, armv7, armv6

Programming Language

Other

Framework

CoreML

Model name and Weights/Checkpoints URL

White Box Cartoonization

Description

Hello,

How I can achieve CoreML end proper result? Because it's MLMultiArray, generating image is different base on CoreML model.



### Relevant Log Output

_No response_

### URL or source code for simple inference testing code

_No response_
ioskevinshah commented 2 years ago
let model = try white_box_cartoonization_720x720_float32(configuration: self.coreMLConfiguration)
            let pixelBuffer = image.pixelBuffer(width: 512, height: 512)!

            let output = try model.prediction(input: preprocess(image: image, size: CGSize(width: 720, height: 720))!)
            let newImage = output.add_1.image()
            let newImage1 = output.add_1.image(min: 0, max: 1, channel: nil, axes: nil)
            let newImage2 = output.add_1.image(min: 0, max: 0, channel: 0, axes: nil)
            let newImage3 = output.add_1.image(min: 0, max: 1, channel: 0, axes: nil)
            let newImage4 = output.add_1.image(min: 1, max: 1, channel: nil, axes: nil)
            let newImage5 = output.add_1.image(min: 0, max: 0, channel: nil, axes: nil)

            let newImage6 = output.add_1.image(min: 0, max: 0, channel: 1, axes: (1,3,3))
            let newImage7 = output.add_1.image(min: 0, max: 0, channel: 0, axes: (1,3,3))
            let newImage8 = output.add_1.image(min: 0, max: 0, channel: 3, axes: (1,3,3))

            let outputImage = image

every image output is different.

Can please guide us?

Thanks, Kevin Shah

ioskevinshah commented 2 years ago

OR just provide the model, with input and output as CVPixelBuffer. it would be more useful.

Thanks, Kevin Shah

PINTO0309 commented 2 years ago

re_saved_model.zip