Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/developeracademy-postech/2024-nc2-m19-machinelearning
- Owner: DeveloperAcademy-POSTECH
- Created: 2024-06-18T00:34:07.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-20T16:58:32.000Z (5 months ago)
- Last Synced: 2024-06-22T02:36:18.959Z (5 months ago)
- Language: Swift
- Size: 14.7 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 2024-NC2-M19-MachineLearning
## ๐ฅ Youtube Link
(์ถํ ๋ง๋ค์ด์ง ์ ํ๋ธ ๋งํฌ ์ถ๊ฐ)
## ๐ก About Augmented Reality
> **Core ML** : AI ๋ชจ๋ธ์ Apple ๋๋ฐ์ด์ค์ ์ฝ๊ฒ ํตํฉํ ์ ์๊ฒ ํ๋ ๊ฐ๋ ฅํ ํ๋ ์์ํฌ
> **Create ML** : ์ฝ๋์์ฑ ์์ด๋, ์ํ๋ AI ๋ชจ๋ธ์ ์ฝ๊ฒ ๋ง๋ค์ด์ฃผ๋ ๋๊ตฌ
>
>
>
> ML์ **4๊ฐ์ง ๋ถ๋ฅ**
> - Vision: ์ปดํจํฐ ๋น์ ์ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง์ ๋น๋์ค๋ฅผ ์ฒ๋ฆฌํ๊ณ ๋ถ์
> - Natural Language: ๋จ์ด ํฌํจ, ๋ถ๋ฅ์ ๊ฐ์ ๋ค์ํ ๋ฐฉ๋ฒ์ผ๋ก ํ ์คํธ๋ฅผ ์ฒ๋ฆฌํ๊ณ ์ดํด
> - Speech: ๋ค์ํ ์ธ์ด์ ๋ํ ์์ฑ ์ธ์ ๋ฐ ํ์ ์ฑ ๊ธฐ๋ฅ์ ํ์ฉ
> - Sound: ์ค๋์ค๋ฅผ ๋ถ์ํ๊ณ ์์์ด๋ ๋ฐ์๊ฐ์ ํน์ ์ ํ์ผ๋ก ๋ถ๋ฅ/์ธ์## ๐ฏ What we focus on?
> Create ML์์ Image Classification ํ ํ๋ฆฟ์ ํ์ฉํ์ฌ ์ง์ AI ๋ชจ๋ธ์ ๋ง๋ค๊ณ , Vision ํ๋ ์์ํฌ์ธ VNCoreMLContainer๋ฅผ ํ์ฉํ์ฌ ์ง์ ๋ง๋ ML ๋ชจ๋ธ์ ์ฑ์ ์ ์ฉํ๋ค.
## ๐ผ Use Case
> **๐ฝ ํฌ์คํ ๊ณ ์์ด๋ค์ ๊ตฌ๋ถํ๊ณ ๋ง๋ ๊ณ ์์ด๋ค์ ๊ธฐ๋กํ์!**## ๐ผ๏ธ 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 Visionextension 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)
}
}
}
```