Skip to content

larguello365/PokeDexAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PokéDexAI 🎮

An innovative iOS app that combines nostalgia with cutting-edge machine learning to identify Pokémon by their cries using CoreML and CreateML.

🌟 Overview

PokéDexAI is a SwiftUI-based iOS application that demonstrates advanced iOS development skills by implementing real-time sound classification using Apple's CoreML framework. The app features a retro Game Boy Advance aesthetic while showcasing modern machine learning capabilities to identify Pokémon through audio recognition.

🚀 Key Features

  • Audio-Based Pokémon Recognition: Record Pokémon cries and instantly identify them using a custom-trained CoreML model
  • Real-time Sound Analysis: Leverages Apple's SoundAnalysis framework for efficient audio processing
  • Retro UI Design: Pixel-perfect Game Boy Advance-inspired interface with custom fonts
  • SwiftUI Navigation: Modern navigation patterns with programmatic navigation and sheet presentations
  • Detailed Pokédex Entries: Complete information display including species, height, weight, and descriptions for 5 Pokémon (Bulbasaur, Charmander, Jigglypuff, Pikachu, and Squirtle)

🛠 Technical Stack

Frameworks & Technologies

  • SwiftUI: 100% SwiftUI implementation for modern, declarative UI
  • CoreML: Custom machine learning model integration for sound classification
  • CreateML: Used to train the PokedexCryClassifierModel for audio recognition
  • SoundAnalysis: Apple's framework for analyzing audio signals
  • AVFoundation: Audio recording and session management
  • Combine: Reactive programming for state management

Architecture Highlights

  • MVVM Pattern: Clean separation of concerns with observable objects
  • Custom ML Model: PokedexCryClassifierModel.mlmodel (17KB) trained on Pokémon cry audio samples
  • Modular Components: Reusable views and well-organized file structure
  • Type Safety: Full Codable compliance for data models
  • Permission Handling: Proper microphone permission requests and error handling

📱 App Structure

PokedexAI/
├── Views/
│   ├── ContentView.swift          # Main list view with navigation
│   ├── SoundRecorderView.swift    # Audio recording & ML analysis
│   └── PokemonDetailView.swift    # Detailed Pokémon information
├── Models/
│   ├── Pokemon.swift              # Core data model
│   ├── PokemonLoader.swift        # JSON data loading
│   └── ResultObserver.swift       # Sound analysis observer
├── CoreML/
│   └── PokedexCryClassifierModel.mlmodel  # Custom-trained ML model
└── Resources/
    ├── pokemon.json               # Pokémon database
    └── Assets.xcassets/          # Images and colors

🎯 Core Functionality

Audio Recognition Pipeline

  1. Recording: 3-second audio capture using AVAudioRecorder
  2. Processing: Audio file analysis with SNAudioFileAnalyzer
  3. Classification: ML model inference using SNClassifySoundRequest
  4. Navigation: Automatic navigation to identified Pokémon's detail view

UI/UX Features

  • Custom "Pixel Emulator" font for authentic retro feel
  • Type-specific color palette (18 unique type colors)
  • Responsive list interface with NavigationStack
  • Modal sheet presentation for recording interface
  • Smooth programmatic navigation with result handling

🔧 Technical Implementation Details

Machine Learning Integration

// CoreML model initialization
let model = try PokedexCryClassifierModel(configuration: MLModelConfiguration())
let request = try SNClassifySoundRequest(mlModel: model.model)

// Real-time audio analysis
let analyzer = try SNAudioFileAnalyzer(url: audioURL)
analyzer.add(request, withObserver: ResultObserver { result in
    // Handle classification results
})

Audio Session Management

  • Proper AVAudioSession configuration for recording
  • Permission handling with user-friendly error messages
  • Automatic recording duration control (3 seconds)
  • Temporary file management for audio data

Data Management

  • JSON-based Pokémon database with full Codable support
  • Efficient data loading from Bundle resources
  • Type-safe model structures with Identifiable protocol

📋 Requirements

  • iOS 17.0+
  • Xcode 15.0+
  • iPhone with microphone access
  • Swift 5.9+

About

Pokemon cry recognizer using a CoreML framework built using CreateML

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages