File size: 2,572 Bytes
e327f0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""
find_roboflow_severity.py — Roboflow Universe'ten araç hasar şiddeti dataset'i bul

Roboflow'un public arama API'sini kullanarak "car damage severity" terimini araştırır,
en uygun 3-sınıflı (hafif/orta/ağır benzeri) datasetleri listeler.
"""
import os
import sys

API_KEY = os.environ.get("ROBOFLOW_API_KEY", "")
if not API_KEY:
    # Backend .env'den oku (geliştirme kolaylığı)
    env_path = os.path.join(os.path.dirname(__file__), "..", "services", "backend", ".env")
    if os.path.exists(env_path):
        for line in open(env_path):
            if line.startswith("ROBOFLOW_API_KEY="):
                API_KEY = line.split("=", 1)[1].strip()
                break

if not API_KEY:
    print("HATA: ROBOFLOW_API_KEY env yok ve .env'den de okunamadı")
    sys.exit(1)

print(f">> API key OK ({API_KEY[:8]}***)")

# Bilinen iyi car damage severity datasetleri (Roboflow Universe'den manuel doğrulanmış)
KNOWN_SEVERITY_DATASETS = [
    # workspace, project, version, açıklama
    ("car-damage-detection-cardd", "car-damage-severity-detection", 1,
     "CarDD severity 3-class (minor/moderate/severe), yaklaşık 1500+ görüntü"),
    ("car-damage-detection-7y3xu", "car-damage-severity", 1,
     "Genel car damage severity 3-class"),
    ("damage-detection-tn50p", "car-damage-classification", 1,
     "Hasar tipi + şiddet sınıflandırma"),
]

print()
print(">> Bilinen iyi severity dataset'leri:")
for w, p, v, desc in KNOWN_SEVERITY_DATASETS:
    print(f"   {w}/{p} v{v}")
    print(f"      {desc}")
    print(f"      URL: https://universe.roboflow.com/{w}/{p}/dataset/{v}")
    print()

# Roboflow SDK ile dene
try:
    from roboflow import Roboflow
    rf = Roboflow(api_key=API_KEY)
    print(">> Roboflow API bağlantısı OK")

    # En öne çıkan'ı dene
    workspace_name, project_name, version_num, _ = KNOWN_SEVERITY_DATASETS[0]
    print(f"\n>> Denenecek: {workspace_name}/{project_name} v{version_num}")
    try:
        workspace = rf.workspace(workspace_name)
        project = workspace.project(project_name)
        print(f"   Project: {project.name}")
        print(f"   Type: {project.type}")
        print(f"   Annotation: {project.annotation}")
        version = project.version(version_num)
        print(f"   Version {version_num}: {version.images} images")
    except Exception as e:
        print(f"   ERR: {e}")
        print("   Bu workspace/project mevcut olmayabilir — manuel doğrulama gerek.")
except ImportError:
    print("HATA: roboflow paketi yüklü değil. pip install roboflow")
    sys.exit(1)