Geri Dön

X-ışını fındık görüntülerinde kusur belirlemeye yönelik derin öğrenme tabanlı bir yaklaşım

A deep learning based approach for defect detection in x-ray hazelnut images

  1. Tez No: 997709
  2. Yazar: SULTAN MURAT YILMAZ
  3. Danışmanlar: DR. ÖĞR. ÜYESİ SERAP ÇAKAR KAMAN, DR. ÖĞR. ÜYESİ ERKAN GÜLER
  4. Tez Türü: Doktora
  5. Konular: Ziraat, Bilgisayar Mühendisliği Bilimleri-Bilgisayar ve Kontrol, Agriculture, Computer Engineering and Computer Science and Control
  6. Anahtar Kelimeler: Akıllı tarım, Bilgisayar yazılımları, Görsel nesne tanıma, Sayısal görüntü işleme, Smart agriculture, Computer softwares, Visual object recognition, Digital image processing
  7. Yıl: 2025
  8. Dil: Türkçe
  9. Üniversite: Sakarya Üniversitesi
  10. Enstitü: Fen Bilimleri Enstitüsü
  11. Ana Bilim Dalı: Bilgisayar Mühendisliği Ana Bilim Dalı
  12. Bilim Dalı: Bilgisayar ve Bilişim Mühendisliği Bilim Dalı
  13. Sayfa Sayısı: Belirtilmemiş.

Özet

Fındık hem Türkiye ekonomisi hem de dünya genelinde tarımsal üretim açısından stratejik öneme sahip bir tarım ürünüdür. Fındığın kalitesi ve randımanı, üretici gelirlerinden ürünün endüstriyel kullanım potansiyeline kadar pek çok parametreyi doğrudan etkilemektedir. Geleneksel kalite ve randıman belirleme yöntemleri, genellikle elle yapılan kontroller, görsel değerlendirmeler ve sınırlı ölçüm cihazlarıyla gerçekleştirilmekte olup, zaman alıcı, yoğun iş gücü gerektiren ve insan faktöründen kaynaklanan hata riskine açık süreçlerdir. Özellikle büyük ölçekli üretim tesislerinde bu yöntemler kalite kontrolünün hızını ve doğruluğunu sınırlamakta, endüstriyel verimliliği düşürmektedir. Bu bağlamda, bu tez çalışması kapsamında fındık üretim süreçlerinde kalite kontrol ve randıman belirleme süreçlerini modern, hızlı, güvenilir ve tekrarlanabilir yöntemlerle iyileştirmek amacıyla tahribatsız X-Işını görüntüleme ve derin öğrenme tabanlı bir fındık kalite belirleme sistemi önerilmiştir. Önerilen sistem, kusurlu, az kusurlu ve kusursuz fındıkları ayrıntılı biçimde tespit ederek, üretim zincirine veri tabanlı karar desteği sağlamış ve kalite kontrol süreçlerinin doğruluğunu önemli ölçüde artırmıştır. Böylece, doğru ve güvenilir fındık randımanı belirleme olanağı sunarak, üreticiden tüketiciye kadar tüm tedarik zincirinde kaliteyi güvence altına almakta ve ekonomik değerlemeyi doğrudan etkilemektedir. Fındık kusur tespitinde kullanılan YOLO (You Only Look Once) v7 derin öğrenme mimarisi, sınırlayıcı kutu regresyonu için geliştirilen DCIoU (Distance Centers Intersection over Union) kayıp fonksiyonu ile entegre edilmiştir. DCIoU, kutu merkezleri arasındaki mesafeyi, genişlik-yükseklik ve en-boy oranlarını eşzamanlı olarak optimize ederek, minimal çakışma alanlarına sahip veya birbirine yakın konumlanmış küçük nesnelerde diğer IoU tabanlı kayıp fonksiyonlarına göre çok daha hızlı ve hassas yakınsama sağlamaktadır. Bu özellik, özellikle fındık çekirdeği üzerindeki küçük veya kısmi kusurların doğru bir şekilde tespit edilmesini mümkün kılmış ve model performansında belirgin iyileşmelere yol açmıştır. DCIoU'nun sağladığı hızlı yakınsama ve düşük regresyon sapması, modelin öğrenme sürecinde stabiliteyi artırmakta ve sınırlayıcı kutu optimizasyonunun erken aşamalarda daha etkili bir biçimde gerçekleşmesini sağlamaktadır. Böylece, küçük boyutlu ve örtüşen kusurların ayrıştırılmasında klasik IoU (Intersection over Union), GIoU (Generalized Intersection over Union), DIoU (Distance Intersection over Union) ve CIoU (Complete Intersection over Union) tabanlı yaklaşımlara kıyasla belirgin avantajlar sağlanmıştır. Sistem ayrıca önerilen Komşuluk İlişkisi Algoritması ile desteklenmiş, model tarafından üretilen sınırlayıcı kutular arasındaki uzamsal süreklilik ve piksel bazlı ilişkileri dikkate alarak segmentasyon çıktıları üretmiştir. Tensör tabanlı bu yapı, her bir pikselin ait olduğu küme ve komşuluk ilişkilerini kapsamlı şekilde temsil ederek manuel etiketleme gereksinimini ortadan kaldırmaktadır. Böylece fındık çekirdekleri üzerindeki kusurların boyut, şekil ve konum bilgileri yüksek doğrulukla elde edilebilmekte ve bu bilgiler randıman hesaplama süreçlerinde doğrudan kullanılabilir hâle gelmektedir. Segmentasyon çıktıları, yalnızca nesne varlığını değil, aynı zamanda her bir kusurun piksel düzeyindeki dağılımını, alanını ve yoğunluğunu belirleyerek fındıkların kusurlu, az kusurlu veya kusursuz olarak sınıflandırılmasını sağlamaktadır. Bu sayede sistem, üretim zincirinde kalite kontrol süreçlerinde daha güvenilir ve tekrarlanabilir sonuçlar üretmektedir. Sistem, X-Işını fındık veri seti ve genel nesne tespiti amacıyla kullanılan COCO-128 veri seti üzerinde test edilmiş, DCIoU ve Komşuluk İlişkisi algoritmaları entegre edilerek eğitilen YOLOv7 modeli, her iki veri setinde de yüksek doğruluk ve kararlı performans sergilemiştir. Kesinlik, duyarlılık, F-1 skoru ve mAP metriklerindeki yüksek değerler, modelin hem fındık kusur tespitinde hem de farklı nesne tespiti senaryolarında güvenilirliğini ortaya koymaktadır. X-Işını veri seti üzerindeki deneylerde, DCIoU tabanlı modelin hem doğruluk hem de hassasiyet açısından önceki IoU tabanlı yaklaşımlara göre üstün performans sağladığı gözlemlenmiştir. Özellikle segmentasyon çıktılarıyla desteklenen yaklaşım, küçük ve örtüşen kusurların ayrıştırılmasında klasik YOLOv7 modeline kıyasla çok daha başarılı sonuçlar üretmiştir. Tez kapsamında yapılan deneysel çalışmalar, DCIoU'nun optimizasyon sürecindeki üstün yakınsama davranışını ve regresyon sapmasını minimize etme kapasitesini doğrulamıştır. Ayrıca Komşuluk İlişkisi algoritması, NMS (Non-Maximum Suppression) süreçlerine alternatif bir yaklaşım kazandırarak sınırlayıcı kutuların seçimini optimize etmiş ve segmentasyon süreçlerinin doğrudan nesne tespiti çıktılarından türetilebileceğini göstermiştir. Bu tez çalışması, X-Işını görüntüleme ve derin öğrenme tabanlı analizleri bütünleştirerek fındık kalite belirleme ve randıman hesaplama süreçlerinde hassas, hızlı ve güvenilir bir sistem geliştirmiştir. Sistem, yalnızca kusur tespitini iyileştirmekle kalmayıp, üretim süreçlerinde otomasyon, veri tabanlı karar mekanizmaları ve kalite kontrol verimliliğini artırmaktadır. Bu özellikler, fındık üretiminde hem akademik hem de endüstriyel açıdan yüksek katma değer sağlayacak bir kalite kontrol ve randıman hesaplama çözümü sunmaktadır.

Özet (Çeviri)

Hazelnut is a strategic agricultural product for both the Turkish economy and global agricultural production. Its annual production volume and position in the world market allow hazelnuts to play a critical role within the agricultural production chain. Agricultural hazelnut quality and the hazelnut kernel percentage directly affect numerous parameters, ranging from producer income to the industrial utilization potential of the product. Therefore, accurately and reliably assessing the quality level of hazelnuts is of great importance not only for securing producer income but also for determining the industrial usage potential of the product and ensuring the sustainability of the agricultural production chain. In the literature and current practices, the most common method used to determine agricultural hazelnut quality is the calculation of the hazelnut kernel percentage, also known as the sound hazelnut ratio. Türkiye is the leading country in global hazelnut production, with intensive cultivation in Giresun, Ordu, Samsun, and other regions of the Black Sea; this provides strategic importance in both the domestic market and international trade. Traditional methods for determining agricultural hazelnut quality and the hazelnut kernel percentage are typically carried out through manual inspections, visual assessments, and limited measuring instruments. These methods are time-consuming, labor-intensive, and prone to errors arising from human factors. Especially in large-scale production facilities, such traditional approaches limit the speed and accuracy of quality control and reduce industrial efficiency. In this context, this thesis proposes a non-destructive X-ray imaging and deep learning-based hazelnut quality determination system to improve quality control and hazelnut kernel percentage estimation processes in hazelnut production using modern, fast, reliable, and repeatable techniques. The proposed system provides data-driven decision support to the production chain by accurately identifying defective, slightly defective, and defect-free hazelnuts, thereby significantly enhancing the accuracy of quality control procedures. In doing so, it offers the ability to determine the hazelnut kernel percentage accurately and reliably, ensuring quality throughout the entire supply chain-from producer to consumer-and directly influencing economic valuation. In this thesis, a dedicated X-ray hazelnut dataset was constructed for the training and evaluation of the deep learning model developed for hazelnut defect detection. The dataset includes five different hazelnut varieties collected from the provinces of Samsun, Ordu, and Giresun in Türkiye, consisting of a total of 1320 labeled X-ray images. The images were meticulously annotated to accurately reflect the internal structure of the hazelnut kernel and possible defects, with each defective region marked in detail at the pixel level. This comprehensive annotation process ensured high accuracy in regional defect detection and enabled reliable assessment of the object detection and segmentation performance of the developed methods. During dataset construction, each hazelnut sample was scanned at high resolution using an X-ray device, and preprocessing steps were applied to preserve image quality and maximize the visibility of defects. In the preprocessing stage, hazelnut kernel regions were identified using the Otsu filtering method, while defect areas were enhanced using CLAHE, blur, and Anisotropic Diffusion filters, simultaneously reducing noise, improving contrast, and increasing object clarity. This process played a critical role in accurately detecting small, partial, or overlapping defects and provided the model with clean, optimized input data for training. For hazelnut defect detection, the YOLOv7 deep learning architecture, known for its high accuracy and fast inference capabilities, was selected. In particular, the DCIoU (Distance Centers Intersection over Union) loss function was proposed and integrated into the model to enhance bounding box regression performance. DCIoU overcomes the limitations of traditional IoU-based loss functions, which consider only the overlap area, by simultaneously optimizing the distance between box centers, width-height ratios, and aspect ratio consistency. Consequently, even in cases where there is minimal overlap between boxes or defects occupy very small pixel areas, the model can learn the correct regression direction at early stages and achieve rapid convergence. Since most defects encountered within the internal structure of hazelnuts-such as rot, voids, cracks, mold, and deformations-appear with low contrast, in fragmented forms, or partially, correct alignment of box centers plays a critical role in detection performance. DCIoU penalizes these center misalignments, enabling the model to localize defect regions with more precise boundaries; this provides a significant advantage over traditional IoU, GIoU, DIoU, and CIoU methods, particularly for defects that are closely positioned or overlapping. Moreover, including the geometric ratios of the boxes in the optimization contributes to more consistent modeling of defects with varying sizes and shapes. The low regression deviation produced by DCIoU enhances stability during the learning process and allows the model to establish a more balanced error distribution, particularly in the early epochs. Experimental results indicate that the YOLOv7 model utilizing DCIoU demonstrates significant improvements in detecting small and partial defects, marking them with high accuracy, and overall enhances object detection performance. Consequently, the requirements for high precision and low error tolerance, which are essential in hazelnut quality grading systems, are effectively met. To enhance the model's detection performance and generate segmentation outputs, a Neighborhood Relationship Algorithm was developed and integrated. This algorithm evaluates spatial continuity and pixel-level relationships among multiple bounding boxes produced by the model, selecting the most appropriate boxes and filtering out unnecessary duplicates. The output of the algorithm generates tensor structures that can be directly used in the segmentation process. This tensor-based structure comprehensively represents the cluster and neighborhood relationships of each pixel, eliminating the need for manual annotation. Consequently, the size, shape, and location information of defects on hazelnut kernels can be obtained with high accuracy and used directly in hazelnut kernel percentage calculations. The segmentation outputs not only identify the presence of objects but also determine the pixel-level distribution, area, and density of each defect, enabling hazelnuts to be classified as defective, slightly defective, or defect-free. In this way, the system produces more reliable and repeatable results in quality control processes throughout the production chain. Within the scope of this thesis, two separate simulation tests were conducted to compare the performance of DCIoU with existing IoU-based approaches. In these simulation environments, various synthetic data scenarios were created in which object sizes varied, overlap ratios between boxes changed, and center positions were systematically shifted. The findings indicate that the DCIoU loss function achieves significantly faster convergence during optimization compared to other commonly used approaches such as IoU, GIoU, DIoU, and CIoU. Furthermore, DCIoU was observed to maintain lower regression error levels and to perform more stable and accurate bounding box alignment, particularly in scenarios involving small or partial objects. This demonstrates that DCIoU's capacity to precisely optimize the distances between box centers substantially improves the overall performance of the model and provides supportive evidence for the results obtained on real data. In addition to these simulation tests, the system was evaluated on both the X-ray hazelnut dataset and the COCO-128 dataset, which is commonly used for general object detection. The YOLOv7 model trained with the integration of DCIoU and the Neighborhood Relationship Algorithm demonstrated high accuracy and stable performance on the X-ray hazelnut dataset as well. High values in precision, recall, F-1 score and mAP metrics indicate the model's reliability in both hazelnut defect detection and various object detection scenarios. In experiments on the X-ray dataset, the DCIoU-based model exhibited superior performance in terms of both accuracy and sensitivity compared to previous IoU-based approaches. In particular, the approach supported by segmentation outputs produced significantly better results in distinguishing small and overlapping defects than the standard YOLOv7 model. The experimental studies confirmed DCIoU's superior convergence behavior during optimization and its capacity to minimize regression deviation. Additionally, the Neighborhood Relationship Algorithm provided an alternative approach to classical NMS (Non-Maximum Suppression) processes, optimizing the selection of bounding boxes and demonstrating that segmentation processes can be directly derived from object detection outputs. By integrating X-ray imaging with deep learning–based analyses, the system offers a precise, fast, and reliable solution for hazelnut quality assessment and hazelnut kernel percentage calculations. It not only improves defect detection but also enhances automation, data-driven decision-making, and quality control efficiency in production processes. In conclusion, this thesis combines deep learning and non-destructive X-ray imaging methods to provide an innovative and practical solution that ensures high accuracy, reliability, and operational efficiency in hazelnut quality assessment and hazelnut kernel percentage calculation processes. The system offers a comprehensive and automated workflow, from detecting small and overlapping defects to segmentation, thereby securing quality throughout the hazelnut production chain and directly supporting economic valuation.

Benzer Tezler

  1. Enerji dağılımlı x-ışını floresans spektrometresi ile demir ve fındık numunelerinin analizi

    Başlık çevirisi yok

    METİN BAL

    Yüksek Lisans

    Türkçe

    Türkçe

    1996

    Fizik ve Fizik MühendisliğiOndokuz Mayıs Üniversitesi

    Fizik Ana Bilim Dalı

    PROF. DR. NAZMİ OKUMUŞOĞLU

  2. Ayçekirdeği ve fındık kabuğundan aktif karbon üretimi ve kirletici adsorbsiyonu

    Production of activated carbon from sun flower shells and hazelnut shells and adsorption of pollutants

    ZEYNEP ŞENGEL

    Yüksek Lisans

    Türkçe

    Türkçe

    2005

    Kimya MühendisliğiGazi Üniversitesi

    Kimya Mühendisliği Ana Bilim Dalı

    PROF.DR. CANAN CABBAR

  3. Alkali ve çeşitli asitlerle modifiye fındık kabuğu atığı esaslı bioepoksi kompozitlerin hazırlanması ve karakterizasyonu

    Preparation and characterzation of various acid and alkali modified hazelnut shell wastes based bioepoxy

    PINAR ULUSOY

    Yüksek Lisans

    Türkçe

    Türkçe

    2019

    Kimya MühendisliğiSelçuk Üniversitesi

    Kimya Mühendisliği Ana Bilim Dalı

    PROF. DR. GÜLNARE AHMETLİ

  4. Fındık dış kabuğu külünün puzzolanik özellikleri

    Başlık çevirisi yok

    ALİ NEZİHİ TULGAR

    Yüksek Lisans

    Türkçe

    Türkçe

    1996

    İnşaat MühendisliğiYıldız Teknik Üniversitesi

    İnşaat Mühendisliği Ana Bilim Dalı

    YRD. DOÇ. DR. FEVZİYE AKÖZ

  5. Fındık, fıstık ve kayısı çekirdeği kabuğu tozları ile küllerinin karakterizasyonu ve kompozit özelliklerinin belirlenmesi

    Characterization of hazelnut, pistachio and apricot kernel shell powders and ashes, and determination of their composite properties

    ROJİN YALÇIN

    Yüksek Lisans

    Türkçe

    Türkçe

    2020

    Makine MühendisliğiBatman Üniversitesi

    Makine Mühendisliği Ana Bilim Dalı

    DOÇ. DR. YAHYA HIŞMAN ÇELİK