CoreML-Models
Converted CoreML Model Zoo.
CoreML is a machine learning framework by Apple. If you are iOS developer, you can easly use machine learning models in your Xcode project.
How to use
Take a look this model zoo, and if you found the CoreML model you want, download the model from google drive link and bundle it in your project. Or if the model have sample project link, try it and see how to use the model in the project. You are free to do or not.
Section Link
How to get the model
You can get the model converted to CoreML format from the link of Google drive. See the section below for how to use it in Xcode. The license for each model conforms to the license for the original project.
Image Classifier
Efficientnet
Google Drive Link | Size | Dataset | Original Project | License |
---|---|---|---|---|
Efficientnetb0 | 22.7 MB | ImageNet | TensorFlowHub | Apache2.0 |
Efficientnetv2
Google Drive Link | Size | Dataset | Original Project | License | Year |
---|---|---|---|---|---|
Efficientnetv2 | 85.8 MB | ImageNet | Google/autoML | Apache2.0 | 2021 |
VisionTransformer
An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale.
Google Drive Link | Size | Dataset | Original Project | License | Year |
---|---|---|---|---|---|
VisionTransformer-B16 | 347.5 MB | ImageNet | google-research/vision_transformer | Apache2.0 | 2021 |
Conformer
Local Features Coupling Global Representations for Visual Recognition.
Google Drive Link | Size | Dataset | Original Project | License | Year |
---|---|---|---|---|---|
Conformer-tiny-p16 | 94.1 MB | ImageNet | pengzhiliang/Conformer | Apache2.0 | 2021 |
DeiT
Data-efficient Image Transformers
Google Drive Link | Size | Dataset | Original Project | License | Year |
---|---|---|---|---|---|
DeiT-base384 | 350.5 MB | ImageNet | facebookresearch/deit | Apache2.0 | 2021 |
RepVGG
Making VGG-style ConvNets Great Again
Google Drive Link | Size | Dataset | Original Project | License | Year |
---|---|---|---|---|---|
RepVGG-A0 | 33.3 MB | ImageNet | DingXiaoH/RepVGG | MIT | 2021 |
Object Detection
YOLOv5s
Google Drive Link | Size | Output | Original Project | License | Note | Sample Project |
---|---|---|---|---|---|---|
YOLOv5s | 29.3MB | Confidence(MultiArray (Double 0 × 80)), Coordinates (MultiArray (Double 0 × 4)) | ultralytics/yolov5 | GNU | Non Maximum Suppression has been added. | CoreML-YOLOv5 |
Segmentation
U2Net
Google Drive Link | Size | Output | Original Project | License |
---|---|---|---|---|
U2Net | 175.9 MB | Image(GRAYSCALE 320 × 320) | xuebinqin/U-2-Net | Apache |
U2Netp | 4.6 MB | Image(GRAYSCALE 320 × 320) | xuebinqin/U-2-Net | Apache |
face-Parsing
Google Drive Link | Size | Output | Original Project | License | Sample Project |
---|---|---|---|---|---|
face-Parsing | 53.2 MB | MultiArray(1 x 512 × 512) | zllrunning/face-parsing.PyTorch | MIT | CoreML-face-parsing |
Segformer
Simple and Efficient Design for Semantic Segmentation with Transformers
Google Drive Link | Size | Output | Original Project | License | year |
---|---|---|---|---|---|
SegFormer_mit-b0_1024x1024_cityscapes | 14.9 MB | MultiArray(512 × 1024) | NVlabs/SegFormer | NVIDIA | 2021 |
BiSeNetV2
Bilateral Network with Guided Aggregation for Real-time Semantic Segmentation
Google Drive Link | Size | Output | Original Project | License | year |
---|---|---|---|---|---|
BiSeNetV2_1024x1024_cityscapes | 12.8 MB | MultiArray | ycszen/BiSeNet | Apache2.0 | 2021 |
Super Resolution
Real ESRGAN
Google Drive Link | Size | Output | Original Project | License | year |
---|---|---|---|---|---|
Real ESRGAN | 66.9 MB | Image(RGB 1280x1280) | xinntao/Real-ESRGAN | BSD 3-Clause License | 2021 |
BSRGAN
Google Drive Link | Size | Output | Original Project | License | year |
---|---|---|---|---|---|
BSRGAN | 66.9 MB | Image(RGB 2048x2048) | cszn/BSRGAN | 2021 |
Low Light Enhancement
StableLLVE
Learning Temporal Consistency for Low Light Video Enhancement from Single Images.
Google Drive Link | Size | Output | Original Project | License | Year |
---|---|---|---|---|---|
StableLLVE | 17.3 MB | Image(RGB 512x512) | zkawfanx/StableLLVE | MIT | 2021 |
Image Restoration
MPRNet
Multi-Stage Progressive Image Restoration.
Debluring
Denoising
Deraining
Google Drive Link | Size | Output | Original Project | License | Year |
---|---|---|---|---|---|
MPRNetDebluring | 137.1 MB | Image(RGB 512x512) | swz30/MPRNet | MIT | 2021 |
MPRNetDeNoising | 108 MB | Image(RGB 512x512) | swz30/MPRNet | MIT | 2021 |
MPRNetDeraining | 24.5 MB | Image(RGB 512x512) | swz30/MPRNet | MIT | 2021 |
StableLLVE
Learning Temporal Consistency for Low Light Video Enhancement from Single Images.
Google Drive Link | Size | Output | Original Project | License | Year |
---|---|---|---|---|---|
StableLLVE | 17.3 MB | Image(RGB 512x512) | zkawfanx/StableLLVE | ACADEMIC PUBLIC LICENSE | 2021 |
Image Generation
MobileStyleGAN
Google Drive Link | Size | Output | Original Project | License | Sample Project |
---|---|---|---|---|---|
MobileStyleGAN | 38.6MB | Image(Color 1024 × 1024) | bes-dev/MobileStyleGAN.pytorch | Nvidia Source Code License-NC | CoreML-StyleGAN |
DCGAN
Google Drive Link | Size | Output | Original Project |
---|---|---|---|
DCGAN | 9.2MB | MultiArray | TensorFlowCore |
Image2Image
Anime2Sketch
Google Drive Link | Size | Output | Original Project | License | Usage |
---|---|---|---|---|---|
Anime2Sketch | 217.7MB | Image(Color 512 × 512) | Mukosame/Anime2Sketch | MIT | Drop an image to preview |
AnimeGAN2Face_Paint_512_v2
Google Drive Link | Size | Output | Original Project |
---|---|---|---|
AnimeGAN2Face_Paint_512_v2 | 8.6MB | Image(Color 512 × 512) | bryandlee/animegan2-pytorch |
Photo2Cartoon
Google Drive Link | Size | Output | Original Project | License | Note |
---|---|---|---|---|---|
Photo2Cartoon | 15.2 MB | Image(Color 256 × 256) | minivision-ai/photo2cartoon | MIT | The output is little bit different from the original model. It cause some operations were converted replaced manually. |
AnimeGANv2_Hayao
Google Drive Link | Size | Output | Original Project |
---|---|---|---|
AnimeGANv2_Hayao | 8.7MB | Image(256 x 256) | TachibanaYoshino/AnimeGANv2 |
AnimeGANv2_Paprika
Google Drive Link | Size | Output | Original Project |
---|---|---|---|
AnimeGANv2_Paprika | 8.7MB | Image(256 x 256) | TachibanaYoshino/AnimeGANv2 |
WarpGAN Caricature
Google Drive Link | Size | Output | Original Project |
---|---|---|---|
WarpGAN Caricature | 35.5MB | Image(256 x 256) | seasonSH/WarpGAN |
UGATIT_selfie2anime
Google Drive Link | Size | Output | Original Project |
---|---|---|---|
UGATIT_selfie2anime | 266.2MB(quantized) | Image(256x256) | taki0112/UGATIT |
CartoonGAN
Google Drive Link | Size | Output | Original Project |
---|---|---|---|
CartoonGAN_Shinkai | 44.6MB | MultiArray | mnicnc404/CartoonGan-tensorflow |
CartoonGAN_Hayao | 44.6MB | MultiArray | mnicnc404/CartoonGan-tensorflow |
CartoonGAN_Hosoda | 44.6MB | MultiArray | mnicnc404/CartoonGan-tensorflow |
CartoonGAN_Paprika | 44.6MB | MultiArray | mnicnc404/CartoonGan-tensorflow |
How to use in a xcode project.
Option 1,implement Vision request.
import Vision
lazy var coreMLRequest:VNCoreMLRequest = {
let model = try! VNCoreMLModel(for: modelname().model)
let request = VNCoreMLRequest(model: model, completionHandler: self.coreMLCompletionHandler)
return request
}()
let handler = VNImageRequestHandler(ciImage: ciimage,options: [:])
DispatchQueue.global(qos: .userInitiated).async {
try? handler.perform([coreMLRequest])
}
If the model has Image type output:
let result = request?.results?.first as! VNPixelBufferObservation
let uiimage = UIImage(ciImage: CIImage(cvPixelBuffer: result.pixelBuffer))
Else the model has Multiarray type output:
For visualizing multiArray as image, Mr. Hollance’s “CoreML Helpers” are very convenient. CoreML Helpers
Converting from MultiArray to Image with CoreML Helpers.
func coreMLCompletionHandler(request:VNRequest?、error:Error?){
let = coreMLRequest.results?.first as!VNCoreMLFeatureValueObservation
let multiArray = result.featureValue.multiArrayValue
let cgimage = multiArray?.cgImage(min:-1、max:1、channel:nil)
CoreGANContainer. You can use models with dragging&dropping into the container project.
Option 2,UseMake the model lighter
You can make the model size lighter with Quantization if you want. https://coremltools.readme.io/docs/quantization
The lower the number of bits, more the chances of degrading the model accuracy. The loss in accuracy varies with the model.
import coremltools as ct
from coremltools.models.neural_network import quantization_utils
# load full precision model
model_fp32 = ct.models.MLModel('model.mlmodel')
model_fp16 = quantization_utils.quantize_weights(model_fp32, nbits=16)
# nbits can be 16(half size model), 8(1/4), 4(1/8), 2, 1
quantized sample (U2Net)
InputImage / nbits=32(original) / nbits=16 / nbits=8 / nbits=4
Thanks
Cover image was taken from Ghibli free images.
On YOLOv5 convertion, dbsystel/yolov5-coreml-tools give me the super inteligent convert script.
And all of original projects
Auther
Daisuke Majima Freelance engineer. iOS/MachineLearning/AR I can work on mobile ML projects and AR project. Feel free to contact: [email protected]