Created
August 8, 2019 13:25
-
-
Save varol/5acaa2e3e91213519b82f659ed94303a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CreateML | |
import Foundation | |
// Datasetlerimizin bulunduğu klasörün yolunu URL tipinde bir sabite atıyoruz. | |
let dataSetPath = URL(fileURLWithPath: "/Users/Varol/Downloads/TurkishBanknoteDataset-master/train") | |
print(dataSetPath) | |
//Model adında bir sabit oluşturup, dataSetPath'imizi MLImageClassifier yapısına bağlıyoruz. | |
let model = try MLImageClassifier(trainingData: .labeledDirectories(at: dataSetPath)) | |
// Test klasörümüzün yolunu bildiriyoruz | |
let testPath = URL(fileURLWithPath: "/System/Volumes/Data/Users/Varol/Downloads/test") | |
print(testPath) | |
// Şimdi yukarıda oluşturduğumuz modelimizi eğitmeye başlıyoruz. | |
let evaluation = model.evaluation(on: .labeledDirectories(at: testPath)) | |
//Model çıktımızı nereye kaydedeceğini bildiriyoruz. | |
try model.write(to: URL(fileURLWithPath: "/System/Volumes/Data/Users/Varol/Downloads/test/currencyML.mlmodel")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment