Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/developeracademy-postech/2024-nc2-m19-machinelearning


https://github.com/developeracademy-postech/2024-nc2-m19-machinelearning

Last synced: about 6 hours ago
JSON representation

Awesome Lists containing this project

README

        

# 2024-NC2-M19-MachineLearning

## ๐ŸŽฅ Youtube Link

(์ถ”ํ›„ ๋งŒ๋“ค์–ด์ง„ ์œ ํŠœ๋ธŒ ๋งํฌ ์ถ”๊ฐ€)

## ๐Ÿ’ก About Augmented Reality

> **Core ML** : AI ๋ชจ๋ธ์„ Apple ๋””๋ฐ”์ด์Šค์™€ ์‰ฝ๊ฒŒ ํ†ตํ•ฉํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜๋Š” ๊ฐ•๋ ฅํ•œ ํ”„๋ ˆ์ž„์›Œํฌ

> **Create ML** : ์ฝ”๋“œ์ž‘์„ฑ ์—†์ด๋„, ์›ํ•˜๋Š” AI ๋ชจ๋ธ์„ ์‰ฝ๊ฒŒ ๋งŒ๋“ค์–ด์ฃผ๋Š” ๋„๊ตฌ
>
> MLแ„‰แ…ฉแ„€แ…ข
>
> ML์˜ **4๊ฐ€์ง€ ๋ถ„๋ฅ˜**
> - Vision: ์ปดํ“จํ„ฐ ๋น„์ „์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€์™€ ๋น„๋””์˜ค๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ณ  ๋ถ„์„
> - Natural Language: ๋‹จ์–ด ํฌํ•จ, ๋ถ„๋ฅ˜์™€ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ๋ฐฉ๋ฒ•์œผ๋กœ ํ…์ŠคํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ณ  ์ดํ•ด
> - Speech: ๋‹ค์–‘ํ•œ ์–ธ์–ด์— ๋Œ€ํ•œ ์Œ์„ฑ ์ธ์‹ ๋ฐ ํ˜„์ €์„ฑ ๊ธฐ๋Šฅ์„ ํ™œ์šฉ
> - Sound: ์˜ค๋””์˜ค๋ฅผ ๋ถ„์„ํ•˜๊ณ  ์›ƒ์Œ์ด๋‚˜ ๋ฐ•์ˆ˜๊ฐ™์€ ํŠน์ • ์œ ํ˜•์œผ๋กœ ๋ถ„๋ฅ˜/์ธ์‹

## ๐ŸŽฏ What we focus on?

> Create ML์—์„œ Image Classification ํ…œํ”Œ๋ฆฟ์„ ํ™œ์šฉํ•˜์—ฌ ์ง์ ‘ AI ๋ชจ๋ธ์„ ๋งŒ๋“ค๊ณ , Vision ํ”„๋ ˆ์ž„์›Œํฌ์ธ VNCoreMLContainer๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์ง์ ‘ ๋งŒ๋“  ML ๋ชจ๋ธ์„ ์•ฑ์— ์ ์šฉํ•œ๋‹ค.

## ๐Ÿ’ผ Use Case
> **๐Ÿ˜ฝ ํฌ์Šคํ… ๊ณ ์–‘์ด๋“ค์„ ๊ตฌ๋ถ„ํ•˜๊ณ  ๋งŒ๋‚œ ๊ณ ์–‘์ด๋“ค์„ ๊ธฐ๋กํ•˜์ž!**

## ๐Ÿ–ผ๏ธ Prototype

prototype

[์˜์ƒ๋ณด๊ธฐ](https://prod-files-secure.s3.us-west-2.amazonaws.com/2e999faf-43aa-426e-ba81-0a9f876c0c58/669ae909-aed9-494d-877e-bd511374bf7e/RPReplay_Final1718841098.mp4)

## ๐Ÿ› ๏ธ About Code
```swift
import Vision

extension MosuDataModel {
func detect(image: CIImage, completion: @escaping (String) -> Void) {

// CoreML์˜ ๋ชจ๋ธ๋กœ ์‚ฌ์šฉํ•  PocatClassifier2๋ฅผ coreMLModel ๊ฐ์ฒด๋กœ ์ƒ์„ฑ ํ›„,
// Vision ํ”„๋ ˆ์ž„์›Œํฌ์ธ VNCoreMLModel ์ปจํ…Œ์ด๋„ˆ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ CoreML์˜ model์— ์ ‘๊ทผํ•œ๋‹ค.
guard let coreMLModel = try? PocatClassifier2(configuration: MLModelConfiguration()),
let visionModel = try? VNCoreMLModel(for: coreMLModel.model) else {
fatalError("Loading CoreML Model Failed")
}

// Vision์„ ์ด์šฉํ•ด ์ด๋ฏธ์น˜ ์ฒ˜๋ฆฌ๋ฅผ ์š”์ฒญ
let request = VNCoreMLRequest(model: visionModel) { request, error in
guard error == nil else {
fatalError("Failed Request")
}

// ์‹๋ณ„์ž์˜ ์ด๋ฆ„(๊ณ ์–‘์ด ์ด๋ฆ„)์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด VNClassificationObservation๋กœ ๋ณ€ํ™˜ํ•ด์ค€๋‹ค.
guard let classification = request.results as? [VNClassificationObservation] else {
fatalError("Faild convert VNClassificationObservation")
}

// ๋จธ์‹ ๋Ÿฌ๋‹์„ ํ†ตํ•œ ๊ฒฐ๊ณผ๊ฐ’ ํ”„๋ฆฐํŠธ
print(classification)
if let firstItem = classification.first { // ๊ฐ€์žฅ ํ™•๋ฅ ์ด ๋†’์€ ๊ฒฐ๊ณผ๋ฅผ firstItem์— ์ €์žฅ
print(firstItem.identifier.capitalized)
var result = firstItem.identifier.capitalized
result += " "
result += firstItem.confidence.formatted()
completion(firstItem.identifier.capitalized)
} else {
completion("๋ชป์ฐพ์Œ ใ… ")
}
}

// ์ด๋ฏธ์ง€๋ฅผ ๋ฐ›์•„์™€์„œ perform์„ ์š”์ฒญํ•˜์—ฌ ๋ถ„์„ํ•œ๋‹ค. (Vision ํ”„๋ ˆ์ž„์›Œํฌ)
let handler = VNImageRequestHandler(ciImage: image)
do {
try handler.perform([request])
} catch {
print(error)
}
}
}
```