Görüntü İşleme AI: Computer Vision ve Nesne Tanıma Sistemleri
Computer vision ile görüntü ve videoları otomatik analiz edin. YOLO nesne tanıma, image classification, face recognition, OCR sistemleri için kapsamlı teknik rehber ve kod örnekleri.
👁️Computer Vision Temelleri
Computer Vision (Bilgisayarlı Görü), bilgisayarların görüntüleri ve videoları "görmesi" ve anlaması için kullanılan AI teknolojisidir. İnsanın görsel algısını taklit eder.
Temel Computer Vision Görevleri
📦Object Detection (Nesne Tespiti)
Görüntüdeki nesneleri tespit edip sınırlayıcı kutu (bounding box) çizer
- • Otonom araç: Yaya, araba, trafik lambası tespiti
- • Güvenlik kamerası: İnsan, araç takibi
- • E-ticaret: Ürün fotoğrafında nesne sayma
🏷️Image Classification (Görüntü Sınıflandırma)
Tüm görüntüyü tek bir sınıfa atar (kedi/köpek, elma/portakal)
- • Tıbbi görüntüleme: X-ray'de hastalık tespiti
- • Kalite kontrol: İyi/kötü ürün ayrımı
- • İçerik moderasyonu: Uygunsuz görsel tespiti
👤Face Recognition (Yüz Tanıma)
Görüntüdeki yüzleri tespit edip kimlik doğrulama yapar
- • Güvenlik: Yüz tanıma ile giriş sistemi
- • Yoklama: Okul/ofis otomatik yoklama
- • Telefon kilidi: Face ID (iPhone)
📝OCR (Optik Karakter Tanıma)
Görüntüdeki metni okuyup dijital metne çevirir
- • Fatura okuma: Otomatik muhasebe
- • Plaka tanıma: Otopark sistemi
- • Belge dijitalleştirme: PDF'e çevirme
🎯YOLO: En Popüler Nesne Tanıma Modeli
YOLO Nedir?
YOLO (You Only Look Once), real-time nesne tanıma için en hızlı ve doğru modeldir. Tek bir neural network pass'inde tüm nesneleri tespit eder.
YOLO v8 Kurulum ve Kullanım
# 1. YOLOv8 Kurulum
pip install ultralytics opencv-python
# 2. Basit Nesne Tanıma
from ultralytics import YOLO
import cv2
# Model yükle (ilk çalıştırmada indirilir)
model = YOLO('yolov8n.pt') # nano model (hızlı, hafif)
# model = YOLO('yolov8s.pt') # small
# model = YOLO('yolov8m.pt') # medium
# model = YOLO('yolov8l.pt') # large (en doğru)
# Görüntü üzerinde tahmin
results = model('path/to/image.jpg')
# Sonuçları işle
for result in results:
boxes = result.boxes # Bounding box'lar
for box in boxes:
# Koordinatlar
x1, y1, x2, y2 = box.xyxy[0]
# Sınıf ve güven skoru
class_id = int(box.cls[0])
confidence = float(box.conf[0])
class_name = model.names[class_id]
print(f"{class_name}: {confidence:.2f} ({x1},{y1},{x2},{y2})")
# Sonucu görselleştir ve kaydet
annotated_frame = results[0].plot()
cv2.imwrite('output.jpg', annotated_frame)
# Output:
# person: 0.92 (120,50,380,450)
# car: 0.88 (400,200,600,350)
# dog: 0.75 (50,300,150,400)Real-Time Video Analizi
# Webcam veya video dosyasından real-time nesne tanıma
from ultralytics import YOLO
import cv2
model = YOLO('yolov8n.pt')
# Video kaynağı (0 = webcam, veya video dosya yolu)
cap = cv2.VideoCapture(0)
# cap = cv2.VideoCapture('video.mp4') # Video dosyası için
while cap.isOpened():
success, frame = cap.read()
if not success:
break
# Tahmin (her frame'de)
results = model(frame)
# Annotate edilmiş frame al
annotated_frame = results[0].plot()
# Ekranda göster
cv2.imshow('YOLOv8 Detection', annotated_frame)
# 'q' tuşuna basılırsa çık
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()Özel Model Eğitimi (Custom Dataset)
# Kendi veri setinle YOLO eğitme (örn: Ürün tespiti)
# 1. Veri seti hazırla (YOLO formatında)
# dataset/
# ├── images/
# │ ├── train/ (1000+ görsel)
# │ └── val/ (200+ görsel)
# └── labels/
# ├── train/ (.txt annotation dosyaları)
# └── val/
# 2. data.yaml oluştur
# path: /path/to/dataset
# train: images/train
# val: images/val
# names:
# 0: laptop
# 1: phone
# 2: tablet
# 3. Model eğitimi
from ultralytics import YOLO
model = YOLO('yolov8n.pt') # Pre-trained model ile başla
# Eğitim
results = model.train(
data='data.yaml',
epochs=100,
imgsz=640,
batch=16,
device=0, # GPU kullan (CPU için 'cpu')
project='product_detection',
name='run1'
)
# 4. En iyi modeli kullan
best_model = YOLO('product_detection/run1/weights/best.pt')
results = best_model('test_image.jpg')
# Örnek Performans:
# - 1000 görsel: ~30 dakika eğitim (GPU)
# - mAP50: %85-92 (kendi veri setinde)
# - Inference: ~50 FPS (GPU)🚗Gerçek Proje: Plaka Tanıma Sistemi
Otopark Plaka Tanıma Sistemi
Plaka Tanıma Kodu
import cv2
import easyocr
from ultralytics import YOLO
# 1. Modelleri yükle
plate_detector = YOLO('plate_detector.pt') # Özel eğitilmiş plaka tespit modeli
reader = easyocr.Reader(['tr']) # Türkçe OCR
def detect_plate(image_path):
# Görüntüyü oku
img = cv2.imread(image_path)
# 1. Plaka tespiti (YOLO)
results = plate_detector(img)
plates = []
for result in results:
for box in result.boxes:
# Plaka bölgesini kırp
x1, y1, x2, y2 = map(int, box.xyxy[0])
plate_roi = img[y1:y2, x1:x2]
# 2. OCR ile karakterleri oku
ocr_results = reader.readtext(plate_roi)
if ocr_results:
plate_text = ocr_results[0][1] # İlk sonuç
confidence = ocr_results[0][2]
# Türk plaka formatı kontrolü (34 ABC 123)
plate_text = clean_plate_text(plate_text)
plates.append({
'text': plate_text,
'confidence': confidence,
'bbox': (x1, y1, x2, y2)
})
return plates
def clean_plate_text(text):
# Sadece harf ve rakam
text = ''.join(c for c in text if c.isalnum())
text = text.upper()
# Türk plaka formatına çevir (34ABC123 → 34 ABC 123)
if len(text) >= 7:
return f"{text[:2]} {text[2:5]} {text[5:]}"
return text
# Kullanım
plates = detect_plate('car_image.jpg')
for plate in plates:
print(f"Plaka: {plate['text']} (Güven: {plate['confidence']:.2f})")
# Output:
# Plaka: 34 ABC 123 (Güven: 0.94)
# Plaka: 06 XYZ 456 (Güven: 0.89)Proje Detayları
Teknik Stack:
- • Plaka Tespiti: YOLO v8 (custom trained, 2000 plaka görseli)
- • OCR: EasyOCR (Türkçe karakterler: Ç, Ğ, İ, Ö, Ş, Ü)
- • Post-processing: Regex, format validation
- • Deployment: FastAPI + Docker
Maliyet ve ROI:
- • Geliştirme: 120K TL (2 ay, 2 ML engineer)
- • GPU Sunucu: RTX 3060, 8K TL/ay
- • Kullanım: 500 otopark, 2,000 araç/gün/otopark
- • Tasarruf: Manuel kayıt yok, %100 otomasyon
- • ROI: 8 ay
💰Maliyet Analizi
| Proje Tipi | Kapsam | Süre | Maliyet |
|---|---|---|---|
| Basit Classification | 2-5 sınıf, 1000 görsel, transfer learning | 2-3 hafta | 40K-80K TL |
| Object Detection | YOLO custom training, 2000+ görsel, annotation | 1-2 ay | 80K-150K TL |
| Face Recognition | Yüz tespiti + embedding + matching, database | 1.5-2.5 ay | 100K-180K TL |
| Enterprise Vision | Multi-task, video analytics, edge deployment | 3-6 ay | 200K-500K TL |
Computer Vision Sisteminizi Kurmaya Hazır Mısınız?
YOLO nesne tanıma, face recognition, OCR çözümleri ile işletmenizi görsel AI ile güçlendirin. Ücretsiz POC için iletişime geçin.
Ücretsiz Vision POC→