• Sonuç bulunamadı

Tarımda Yapay Zeka: R'de Derin Öğrenme İle Hızlı Bir Adım

N/A
N/A
Protected

Academic year: 2021

Share "Tarımda Yapay Zeka: R'de Derin Öğrenme İle Hızlı Bir Adım"

Copied!
14
0
0

Yükleniyor.... (view fulltext now)

Tam metin

(1)

See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/333004763

Tarımda Yapay Zekâ: R'de Derin Öğrenme İle Hızlı Bir Adım

Conference Paper · April 2019

CITATIONS 0

READS 336 Some of the authors of this publication are also working on these related projects:

VatAna: An R Package for Visual Assessment of Clustering Tendency in Numerical DatasetsView project

ppclust: Probabilistic and Possibilistic Cluster AnalysisView project

All content following this page was uploaded by Zeynel Cebeci on 10 May 2019.

(2)
(3)
(4)

1 1 alanda uygu Parametrik ve non-i Anahtar Kelimeler: tik .

, dronlar, biyoteknoloji, finans, yon beklenmektedir [18].

(5)

XVI. Otomatik Kontrol Seminer ve Sergisi, 24-25 Nisan 2019, Adana

ENME

Tahmin etme

uygulamalar

(6)

Tablo 1. Grinblat ve ark. [11] Ferentinos [10] Chen ve ark. [5] Chlingaryan ve ark. [7] Abdullahi ve ark. [2] Cheng ve ark. [6] Rahman ve ark. [14] ir gizli (https://rpackages.io). Keras ve TM

zdaki bir veya daha fazla CPU veya GPU'ya hesaplama "Deep Learning From Scratch VI: TensorFlow" (http://www.deepideas.net/deep-learning-from-scratch-vi-tensorflow) projesi ile

(7)

XVI. Otomatik Kontrol Seminer ve Sergisi, 24-25 Nisan 2019, Adana Tablo 2. Paket Rank nnet 420 - -(FFNN: Feed-neuralnet 497 h2o 541 -RSNNS 960 SNNS aray tensorflow 512 deepnet 1520 - Boltzmann keras 451 darch 14133 rnn 2692 paketidir. FCNN4R 13898 RcppDL 5485 Autoencoder) ve deepr -mxnet -Net automl 5017

basit bir regresyon uydurma

deepNN

-Buddle 9342

deepgm 9246

olarak keras [3] ve tensorflow [4] paketleri mevcuttur. devtools paketi indirilmeli, daha sonra devtools paketindeki install_github ile keras

install.packages("devtools")

devtools::install_github("rstudio/keras")

ketlerden biri reticulate paketidir. Bu paket Python'un

Rtools

https://cran.r-project.org/bin/windows/Rtools/

keras paketi library veya require library(keras)

(8)

install_keras()

install_keras(tensorflow = "gpu") R'nin keras paketinde:

keras

hizmet eden K-

-veriseti > data(iris) > head(iris)

Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa > tail(iris)

Sepal.Length Sepal.Width Petal.Length Petal.Width Species 145 6.7 3.3 5.7 2.5 virginica 146 6.7 3.0 5.2 2.3 virginica 147 6.3 2.5 5.0 1.9 virginica 148 6.5 3.0 5.2 2.0 virginica 149 6.2 3.4 5.4 2.3 virginica 150 5.9 3.0 5.1 1.8 virginica

iris I. setosa, I.versicolor, I. virginica) her

Sepal.Length Sepal.Width ve Petal.Length

Petal.Width larak

k--ortalamalar

> reskm <- kmeans(iris[,-5], centers=3)

> plot(iris$Sepal.Length, iris$Petal.Length, pch=19, col=reskm$cluster)

(9)

-XVI. Otomatik Kontrol Seminer ve Sergisi, 24-25 Nisan 2019, Adana

Iris setosa, Iris versicolor ve Iris virginica

iris verisetinde

k-keras

D: diskinde

deeplearndata iris Training ve Test

Iris setosa, Iris versicolor ve Iris virginica Test

keras logs ise keras

(10)

keras

Program 1 library(keras)

iris_liste <- c("Iris versicolor", "Iris setosa", "Iris virginica") cikti_sinif_sayisi <- length(iris_liste)

goruntu_en <- 160 ; goruntu_boy <- yeni_boyut <- c(goruntu_en, goruntu_boy) kanal_sayisi <-

yigin_buyuklugu <- 5 ; epoch_sayisi <- 20

egitim_klasoru <- "D:/deeplearndata/iris/Training/" test_klasoru <- "D:/deeplearndata/iris/Test/"

(11)

XVI. Otomatik Kontrol Seminer ve Sergisi, 24-25 Nisan 2019, Adana egitim_goruntu_isle <- image_data_generator( rescale=1./255 #, #rotation_range=40, #width_shift_range=0.2, #height_shift_range=0.2, #shear_range=0.2, #zoom_range=0.2, #horizontal_flip=TRUE, #fill_mode="nearest") test_goruntu_isle <- image_data_generator(rescale = 1./255) egitim_goruntuleri <- flow_images_from_directory(egitim_klasoru, egitim_goruntu_isle, target_size = yeni_boyut, class_mode = "categorical", classes = iris_liste, seed=1999) test_goruntuleri <- flow_images_from_directory(test_klasoru, test_goruntu_isle, target_size = yeni_boyut, class_mode = "categorical", classes = iris_liste, seed=1999) egitim_siniflari <- factor(egitim_goruntuleri$classes) test_siniflari <- factor(test_goruntuleri$classes) cat(" n") ; egitim_goruntuleri$class_indices iris_sinif_indisleri <- egitim_goruntuleri$class_indices

save(iris_sinif_indisleri, file = "D:/deeplearndata/iris/iris_sinif_indisleri.RData") egitim_sayisi <- egitim_goruntuleri$n ; test_sayisi <- test_goruntuleri$n

model <- model %>%

layer_conv_2d(filter = 32, kernel_size = c(3,3), padding = "same", input_shape = c(goruntu_en, goruntu_boy, kanal_sayisi)) %>%

layer_activation("relu") %>%

layer_conv_2d(filter = 16, kernel_size = c(3,3), padding = "same") %>% layer_activation_leaky_relu(0.5) %>% layer_batch_normalization() %>% layer_max_pooling_2d(pool_size = c(2,2)) %>% layer_dropout(0.25) %>% layer_flatten() %>% layer_dense(100) %>% layer_activation("relu") %>% layer_dropout(0.5) %>% layer_dense(cikti_sinif_sayisi) %>% layer_activation("softmax") # Modeli derle model %>% compile( loss = "categorical_crossentropy",

optimizer = optimizer_rmsprop(lr = 0.0001, decay = 1e-6), metrics = "accuracy"

#metrics = "mae")

(12)

validation_data = test_goruntuleri, # Test verisi

validation_steps = as.integer(test_sayisi / yigin_buyuklugu), steps_per_epoch = as.integer(egitim_sayisi / yigin_buyuklugu), epochs = epoch_sayisi, # epoch

callbacks = list(

callback_model_checkpoint("D:/deeplearndata/iris/iris_checkpoints.h5", save_best_only = TRUE))

)

save_model_weights_hdf5(model, #Modeli sakla

"D:/deeplearndata/iris/keras/iris_cnn_30_epochsR.h5",overwrite = TRUE) plot(gecmis)

gecmis_df <- as.data.frame(gecmis) str(gecmis_df)

model %>% evaluate_generator(test_goruntuleri, steps=test_sayisi)

tahminler <- model %>% predict_generator(test_goruntuleri, steps=test_sayisi) tahminler <- ifelse(tahminler > 0.5, 1, 0)

tahminler <- data.frame(cbind(tahminler, iris_liste[test_siniflari])) colnames(tahminler) <-

summary(model) Tablo 3.

conv2d_2 (Conv2D) (None, 160, 120, 32) 896

activation_3 (Activation) (None, 160, 120, 32) 0

conv2d_3 (Conv2D) (None, 160, 120, 16) 4624

leaky_re_lu_1 (LeakyReLU) (None, 160, 120, 16) 0

batch_normalization_1 (BatchNormali (None, 160, 120, 16) 64

max_pooling2d_1 (MaxPooling2D) (None, 80, 60, 16) 0

dropout_2 (Dropout) (None, 80, 60, 16) 0

flatten_1 (Flatten) (None, 76800) 0

dense_2 (Dense) (None, 100) 7680100

activation_4 (Activation) (None, 100) 0

dropout_3 (Dropout) (None, 100) 0

dense_3 (Dense) (None, 3) 303

activation_5 (Activation) (None, 3) 0

Total params: 7,685,987 Trainable params: 7,685,955 Non-trainable params: 32

Modelin evaluate_generator sonucunda loss=0.9308241 ve acc= 0.8333333

6'da test (val elde edilebilecektir.

(13)

XVI. Otomatik Kontrol Seminer ve Sergisi, 24-25 Nisan 2019, Adana 3. -se - -4. KAYNAKLAR

1. Abadi, M., Agarwal, A., Barham, P., Brevdo, E., Chen, Z., Citro, C., Corrado, G.S., Davis, A., Dean, J., Devin, M., Ghemawat, S., Goodfellow, I., Harp, A., Irving, G., Isard, M., Jozefowicz, R., Jia, Y., Kaiser, Vinyals, O., Warden, P., Wattenberg, M., Wicke, M., Yu, Y., Zheng, X., 2015. TensorFlow: Large-scale machine learning on heterogeneous systems, (Software available from tensorflow.org).

2. Abdullahi, H. S., Sheriff, R., Mahieddine, F., 2017. Convolution neural network in precision agriculture for plant image recognition and classification. In 2017 Seventh International Conference on Innovative

(14)

XVI. Otomatik Kontrol Seminer ve Sergisi, 24-25 Nisan 2019, Adana

3. Allaire, J.J., Chollet, F., 2019. keras: R Interface to 'Keras'. R package version 2.2.4.9001. https://keras.rstudio.com

4. Allaire, J.J., Chollet, F., 2019. tensorflow: R Interface to 'TensorFlow'. R package version 1.10.0.9001. https://github.com/rstudio/tensorflow.

5. Chen, Y., Lin, Z., Zhao, X., Wang, G., Gu, Y. 2014. Deep learning-based classification of hyperspectral data. IEEE Journal of Selected topics in applied earth observations and remote sensing, 7(6), 2094-2107. 6. Cheng, X., Zhang, Y., Chen, Y., Wu, Y., Yue, Y. 2017. Pest identification via deep residual learning in

complex background. Computers and Electronics in Agriculture, 141, 351-356.

7. Chlingaryan, A., Sukkarieh, S., Whelan, B., 2018. Machine learning approaches for crop yield prediction and nitrogen status estimation in precision agriculture: A review. Computers and Electronics in Agriculture, 151, 61-69.

8. Chollet, F. et al, 2015. Keras. (Accessed online at https://keras.io on 12.03.2019).

9. Chollet, F., Allaire, J.J., 2018. Deep Learning with R. Manning Publications, (ISBN: 9781617295546). 360 p.

10. Ferentinos, K. P., 2018. Deep learning models for plant disease detection and diagnosis. Computers and Electronics in Agriculture, 145, 311-318.

11. Grinblat, G. L., Uzal, L. C., Larese, M. G., Granitto, P. M., 2016. Deep learning for plant identification using vein morphological patterns. Computers and Electronics in Agriculture, 127, 418-424.

12. Kutkina, O., Feuerriege

-bloggers.com/deep-learning-in-r-2/, 8.3.2019).

13. R Core Team, 2018. R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/.

14. Rahman, A., Smith, D., Hills, J., Bishop-Hurley, G., Henry, D., Rawnsley, R. 2016. A comparison of autoencoder and statistical features for cattle behaviour classification. In 2016 international joint conference on neural networks (IJCNN) (pp. 2954-2960). IEEE.

15. Shah, R., 2017a. Deep Learning with R. (Accessed online at https://datascienceplus.com/deep-learning-with-r/ on 8.3.2019)

16. Shah, R., 2017b. Image Classification Done Simply Using Keras. (Accessed online at https://htmlpreview.github.io/?https://github.com/rajshah4/image_keras/blob/master/Rnotebook.nb.html on 8.3.2019)

17. TensorFlow for R Blog (Accessed at https://blogs.rstudio.com/tensorflow/gallery.html on 10.3.2019). 18. Walia, A.S., 2017. How to implement Deep Learning in R using Keras and Tensorflow, in Towards Data

Science. (Accessed online at https://towardsdatascience.com/how-to-implement-deep-learning-in-r-using-keras-and-tensorflow-82d135ae4889 on 8.3.2019).

19. Wang, J., 2017. Deep Learning: An Artifical Intellingence Revolution. White paper ARK Invest Research, NY. (Accessed online at http://research.ark-invest.com on 10.3.2019).

20. Willems, K., 2019. keras: Deep Learning in R. Tutorial at

Şekil

Tablo 1. Grinblat ve ark.  [11] Ferentinos [10] Chen ve ark. [5] Chlingaryan ve ark.  [7] Abdullahi ve ark

Referanslar

Benzer Belgeler

• Robotların otonom navigasyonunda veri yığınından öğrenen matematiksel modeller ve algoritma uygulamaları ile geliştirilen kendi kendine öğrenme yeteneği ve yapay

111.78 seviyesi gün içerisinde takip edilecek ilk destek noktası olarak öne çıkıyor, sonrasında ise 111.51 seviyesinde bulunan 200 günlük ve 11.30 seviyesinde bulunan 50

 Dayanıklı tüketim harcamaları: Hanehalkı tarafından anket ayını içine alan son bir yıl içinde otomobil, beyaz eşya, bilgisayar, televizyon, kamera, mobilya,

Türkiye'den memnun musun? / Hamdolsun, çok şükür. Sonda söylenmesi gereken başta gelsin. Bu cümledeki sorular çıplak halleriyle – tonlamasız – Türkiye'yi

How effective is performance-based assessment tools (PBATs) in developing the students' target skills as assessed by the teachers and the student?... What is the students’

Computational Design Informed by Natural Systems Doğal Sistemlerle Bilgilendirilmiş Hesaplamalı Tasarım Sevil Yazıcı Sürü Zekâsı Yaklaşımı İle Metro

Günümüzde çe¸sitli makine ö ˘grenmesi algoritmaları istatistiksel ö ˘g- renme kuramını temel almaktadır:..

[r]