Derin öğrenme modellerinin hücre veri seti üzerinde eğitilerek kıyaslanması ve mobil ortama uyarlanması
Comparision and mobile application of deep learning models trained on blood cell dataset
Yazar: MEHMET YAVUZ
Danışman: DOÇ. DR. MUSTAFA ZAHİD YILDIZ
Sakarya Uygulamalı Bilimler Üniversitesi / Lisansüstü Eğitim Enstitüsü / Biyomedikal Mühendisliği Ana Bilim Dalı
Derece: Yüksek Lisans, 2020
Konu: Bilgisayar Mühendisliği Bilimleri-Bilgisayar ve Kontrol = Computer Engineering and Computer Science and Control ; Biyoteknoloji = Biotechnology ; Klinik Bakteriyoloji ve Enfeksiyon Hastalıkları = Clinical Microbiology and Infectious Diseases
Dizin: Bilgisayar destekli teşhis = Computer assisted diagnosis ; Erken teşhis = Early diagnosis ; Yapay zeka = Artificial intelligence

Özet:
Derin öğrenme, günümüzde en çok kullanılan yapay zekâ yöntemidir. Bu tekniğin gelişmesi ile birlikte çeşitli derin öğrenme modelleri tasarlanmış ve otomotiv, reklam, bankacılık, sağlık, ziraat gibi birçok farklı alanda akıllı çözümler üretilmiştir. Özellikle sağlık alanında hastalıkların teşhis ve tedavisinde derin öğrenme teknikleri etkili sonuçlar vermektedir. Bu çalışmada da tedavi için erken teşhisin çok önemli olduğu sıtma hastalığının, ileri derin öğrenme yöntemleri ile hızlı tanı konulması, geliştirilen yöntemin kolay, ucuz ve erişilebilir olması hedeflenmiştir. Zîra DSÖ'nün yayınladığı raporlara göre günümüzde hâlâ her yıl yüz binlerce insanın ölüm sebebi sıtma kaynaklıdır.
İleri yapay zekâ tekniklerinden olan derin öğrenme özetle; oluşturulan modellerin binlerce veriden oluşan veri setleri üzerinde eğitilmesi ve eğitilen model ile eğitim veri setinde olmayan benzer ama farklı verilerin saliselerle ölçülebilecek sürelerde ve mobil gibi yüksek işlemci kapasitesi gerektirmeyen ortamlarda sınıflandırılmasını sağlayan matematiksel algoritmalara dayanan bir yöntemdir.
Bu çalışmada güncel derin öğrenme modelleri, yaygın bir kullanıma sahip olan sıtma (hücre) veri seti üzerinde eğitilmiş ve sonuçlarının başarımları karşılaştırılarak değerlendirilmiştir. 27,558 adet kırmızı kan hücresinden oluşan veri seti üzerinde yapılan eğitimlerde yüksek performansa sahip modeller elde edilmiş ve kıyaslamaları yapılmıştır. Eğitimler, son yıllarda Google tarafından geliştirilen EfficientNet modelleriyle öğrenim aktarımı yapılarak gerçekleştirilmiştir. 
Çalışma kapsamında, farklı EfficientNet modellerinin birçok kez farklı parametrelerle otomatik eğitilmesi için parametre setlerini kaydederek döngü içinde çalıştıran bir modül geliştirilmiştir. Bu modül, eğitimler neticesinde alınan çıktıların karşılaştırılmasını kolaylaştırmak amacıyla geliştirilen web uygulamasına bağlanarak bütünleşik çalışan kullanışlı bir araca dönüştürülmüştür. Bu araç sayesinde birçok parametreden oluşan farklı parametre setleri bir seferde eğitime sokulabilmiş ve neticeleri kıyaslanarak en yüksek başarımlı setler tespit edilebilmiştir.
Karşılaştırmalar neticesinde daha yüksek performans elde edilen EfficientNet modeli mobil ortamda çalışacak formata dönüştürülmüş ve dönüştürülen bu mobil model geliştirilen bir mobil uygulamaya yerleştirilmiştir. Geliştirilen mobil uygulama ile model eğitilirken hiç görmediği kırmızı kan hücresi görüntülerinin sağlıklı mı yoksa enfekte mi oldukları tahmini yapılmıştır. Bu sayede sıtma teşhisinin hızlı ve düşük maliyetli olmasının yanında kolay erişilebilir olması amaçlanmıştır.

Abstract:
The innovations in the field of hardware have served artificial intelligence studies to spread rapidly. Deep learning is one of the most used artificial intelligence techniques today. With the development of this technique, various deep learning models have been designed and smart solutions have been produced in many different fields such as automotive, advertising, banking, health, agriculture etc. Especially in the field of health, deep learning technique gives promising results in the diagnosis and treatment of diseases. 
One of the purpose of this study is to provide rapid, easy, cheap and accessible diagnosis of malaria which is a vital disease with advanced deep learning methods and mobile technologies. Despite a 28% decline in malaria cases and mortality since 2010, there were approximately 219 million malaria cases (between 203 and 262 million to be exact) and 435,000 malaria deaths globally in 2017, according to the World Malaria Report 2018 which was published by the World Health Organization. The most tragic incident in the World Health Organization African Region, where 93% of all malaria deaths occurred, was that 61% of all deaths were children under the age of 5. It is observed that the most common regions of the parasite causing the disease are Africa, South East Asia and the Eastern Mediterranean, respectively. Its annual cost is estimated to be $12 billion. 
After a person is bitten by a malaria-carrying mosquito, the symptoms of the disease are not noticed for a week to a month. During this time, the malaria parasites reproduce in the person's liver before they invade the red blood cells in the bloodstream. Once inside the red blood cells, the parasites continue to multiply and spread the infection. Infected red blood cells eventually rupture, and the patient will show flu-like symptoms such as sweating, high fever, chills and nausea. Incorrect treatment methods cause irreversible damages and deaths in patients due to mixing with other diseases. That is why early diagnosis has vital importance for treatment of malaria disease. Because of these factors our study is highly important.
Generally, the diagnosis is made by scanning the laboratory results and passing them through human control. Difficulties such as specialist training and human-induced errors impose limitations on the diagnosis of the disease through human control of laboratory results. Due to these problems, the use of artificial intelligence and image classification techniques in the diagnosis of malaria comes to the fore.
In recent years, significant gains have been achieved in machine vision systems due to the development of camera sensors and the increase in processing power and high performance models have been created in machine vision applications. At the same time, the decrease in the prices of camera-based systems has prepared the environment for the application of artificial vision in a wide variety of fields.

Improvements in fast computers and algorithms have led to advances in machine learning and sensors. The increase in access to large amounts of data and developments in graphic processors made deep learning methods, one of the artificial intelligence techniques, applicable. Deep learning models appear to solve multivariate and complex problems. Besides, some problems arise with large and unlabeled datasets. Deep learning techniques solve this problem by learning relationships through features and hierarchies.
In recent studies, deep learning models have offered better predictive performance than existing solutions in various fields and purposes in image processing, cybersecurity and internet of things, voice recognition. Under the framework of deep learning, Convolutional Neural Networks, an algorithm based on artificial neural networks, have also been found to be superior to traditional learning algorithms such as K-Nearest Neighbors, Multilayer Perceptron and Support Vector Machine in many aspects of image processing.
As an advanced artificial intelligence technique deep learning briefly is a method based on mathematical algorithms. That enables the models to be trained on datasets consisting of huge amount of data and to classify similar but different data that are not in the training dataset. With a well-trained model, classification process takes only milliseconds. Moreover, in order to use trained models does not require high processor capacities. So this feature makes mobile devices are suitable platforms to run trained deep learning models.
Some difficulties encountered in model training for new problems both interrupt the research and increase the investment cost. Processes such as collecting data for each new problem, extracting data, labeling the data and training the new model again take a serious amount of time in the research process. Often for new problems; It is not possible to collect data and create a model. In order to overcome these problems, Transfer Learning technique was used in this study. Transfer Learning is the application of the knowledge (learned points) acquired during or as a result of model training for a problem solving to another related problem.
Transfer Learning has been found based on the human use of previous experiences in new problems. In the light of these experiences, problems are likely to be solved faster or more effectively. For example; A person who can play an instrument can play another instrument more easily than the first, or a person learning a new language can learn another language more easily. The basics of Transfer Learning are discussed in a study on "learning to learn". Transfer Learning, since 1995; It has attracted more and more attention under different names such as "learning to learn", "lifelong learning", "knowledge / experience transfer", "multitasking learning", "knowledge reinforcement", "cumulative learning".
Transfer Learning is often accomplished by reusing previously trained models for similar problems. A pre-trained model is taken, it is edited for the problem to be applied (e.g., the last layer of the model is changed according to the number of classes) and training is initiated. In this way; More effective results are obtained in a shorter time than creating a model from the beginning. Because the model used was previously trained and shaped for millions of images and thousands of classes. Transferring the learned knowledge provides convenience in new problems and in this way has been instrumental in many successful studies in different fields.
In this study, recently developed deep learning models were trained on a very common dataset. Malaria dataset consists 27,558 red blood cell images which was collected in Bangladesh. Half of the red blood cell images are parasitized and the other half is uninfected. So the dataset is well balanced which means it is a quite suitable dataset in order to deep learning training. The images were manually labelled by an expert slide reader in Thailand.
Convolutional Neural Networks, which are used extensively in image analysis processes, are multi-layer and feed-forward deep learning techniques. EfficientNet is a new convolutional neural network study developed by Google in 2019, provides significant improvements in accuracy and performance. Some prominent features of EfficienNet models are lightness and high performance. These features were effective in choosing EfficientNet models in this study. 
Existing Convolutional Neural Networks models usually focus on increasing the number of layers (depth), width or resolution alone to increase accuracy, while EfficientNet uses the compound scaling method, which is a simple but effective method they have developed, to increase the depth, width and resolution dimensions together at a specified rate.
By using EfficientNet models, high accuracy results up to 98% were obtained in the trainings conducted on dataset and comparisons were made. This is the proof of concept that EfficientNet models can successfully deal with diagnosis of malaria disease.
Within the scope of the study, an automatized deep learning tool has been developed that consists the logging module and the visual comparison module. The logging module provides automatically train of different EfficientNet deep learning models with different parameters. The module takes parameter sets and runs them in a loop. In each loop different models are trained with different parameters. At the end of each loop training results are saved on log files. This module has been transformed into a useful deep learning tool by connecting to the visual comparison module. The visual comparison module is a web application that developed in order to facilitate the comparison of input parameters and of the outputs obtained as a result of the training.
According to comparisons of results of trainings, the model which achieved the highest test performance was selected. By using Tensorflow technologies, selected model has been converted to "tflite" file format which can be used in mobile devices to make predictions on red blood cell images which has never been seen by the model during training. And a mobile application was developed with converted model. With the developed mobile application, it is aimed to make malaria diagnosis fast and low cost as well as easy accessible.
This is the first academic study that trains models with transfer learning technique by using EfficientNet models in in order to diagnosis of malaria disease from parasitized red blood cell images. The fact that the model has a performance of 98% in itself is a successful study, and it is a promising study when examined in the context of malaria diagnosis. As a result of these inferences, it is evaluated that modes built on EfficientNet models with transfer learning technique are suitable for use in the field of medicine and will shed light on future studies.