Giter VIP home page Giter VIP logo

ardiffmuseum's Introduction

iOS app - AR Diffusion Museum

An iOS app that generates images using Stable Diffusion and displays them in AR.

AppIcon

You can generate images specifying any prompt (text) and display them on the wall in AR.

  • macOS 13.1 or newer, Xcode 14.2 or newer
  • iPhone Pro 12+ / iOS 16.2+, iPad Pro with M1/M2 / iPadOS 16.2+

You can run the app on above mobile devices. And you can run the app on Mac, building as a Designed for iPad app.

This Xcode project uses the Apple/ml-stable-diffusion Swift Package.

  • Apple/ml-stable-diffusion Swift Package/Library
  • SwiftUI, ARKit, RealityKit

This project does not contain the CoreML models of Stable Diffusion v2 (SD2). You need to make them converting the PyTorch SD2 models using Apple converter tools. You can find the instructions of converting models in Apple's repo on GitHub.

There is a Readme in another GitHub Repository that explains how to add Stable Diffusion CoreML models to your Xcode project. Please refer to it.

Change Log

  • [1.0.2 (3)] - 2022-12-18 [Merged]

    • merged the PR by Sergey Dikarev. It uses the configuration, MLModelConfiguration.computeUnits = .cpuAndGPU, when creating a StableDiffusionPipeline. This configuration is suitable for mobile devices. And it adds two entitlements, Extended Virtual Addressing and Increased Memory Limit. They are suitable for an execution on iPhone.
    • if you encounter signing and capability errors for the entitlements, make sure that you are using the App ID which are registered the capabilities, "Extended Virtual Address Space" and "Increased Memory Limit", at Developer - Identifiers site.
    • not use the .cpuAndGPU config when running on macOS, otherwise it causes errors.
    • disable displaying intermediate images when running on devices, to improve the performance.
  • [1.0.1 (2)] - 2022-12-16 [Changed]

    • use apple/ml-stable-diffusion Swift Package v0.1.0.
    • set reduceMemory option of StableDiffusionPipeline(resource:) to true.
    • iPhone requirements was changed to iPhone Pro 12+.

Features

  1. image generation using Stable Diffusion v2 on device
  2. showing generating images step by step
  3. saving generated images in Photo Library
  4. displaying generated images on the wall in AR
  5. automatic switching of displayed images at regular intervals
  6. automatic enlargement according to viewing distance (Large projection on outdoor walls)
  7. built-in sample images

Image

Image

Image

UI

This project provides a minimal UI. Feel free to extend it as you like.

Image

Consideration

MPS internal error

  • Currently, using CoreML Stable Diffusion Library and RealityKit API such as ModelEntity.load(name:) together often causes MPS internal errors.
  • As a workaround, the 3D model of the picture frame is replaced with a simple one now.

In action on iPad: image generation => AR display Image

Related apps

There are related app's repo on GitHub.

Image

References

MIT License

ardiffmuseum's People

Contributors

vtongcoder avatar archiegoodwin avatar ynagatomo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.