─░├žeri─če ge├ž

Geli┼čmi┼č Veri G├Ârselle┼čtirme: Ultralytics YOLOv8 kullanarak ─▒s─▒ haritalar─▒ ­čÜÇ

Is─▒ Haritalar─▒na Giri┼č

ile olu┼čturulan bir ─▒s─▒ haritas─▒ Ultralytics YOLOv8 karma┼č─▒k verileri canl─▒, renk kodlu bir matrise d├Ân├╝┼čt├╝r├╝r. Bu g├Ârsel ara├ž, de─či┼čen veri de─čerlerini temsil etmek i├žin daha s─▒cak tonlar─▒n daha y├╝ksek yo─čunluklar─▒ ve daha so─čuk tonlar─▒n daha d├╝┼č├╝k de─čerleri belirtti─či bir renk yelpazesi kullan─▒r. Is─▒ haritalar─▒ karma┼č─▒k veri modellerini, korelasyonlar─▒ ve anomalileri g├Ârselle┼čtirmede m├╝kemmeldir ve ├že┼čitli alanlarda veri yorumlamas─▒na eri┼čilebilir ve ilgi ├žekici bir yakla┼č─▒m sunar.



─░zle: Is─▒ haritalar─▒ kullanarak Ultralytics YOLOv8

Veri Analizi i├žin Neden Is─▒ Haritalar─▒n─▒ Se├žmelisiniz?

  • Sezgisel Veri Da─č─▒l─▒m─▒ G├Ârselle┼čtirme: Is─▒ haritalar─▒, karma┼č─▒k veri k├╝melerini anla┼č─▒lmas─▒ kolay g├Ârsel formatlara d├Ân├╝┼čt├╝rerek veri yo─čunlu─ču ve da─č─▒l─▒m─▒n─▒n anla┼č─▒lmas─▒n─▒ kolayla┼čt─▒r─▒r.
  • Etkili ├ľr├╝nt├╝ Tespiti: Verileri ─▒s─▒ haritas─▒ bi├žiminde g├Ârselle┼čtirerek e─čilimleri, k├╝meleri ve ayk─▒r─▒ de─čerleri tespit etmek daha kolay hale gelir ve daha h─▒zl─▒ analiz ve i├žg├Âr├╝ sa─člar.
  • Geli┼čmi┼č Mek├ónsal Analiz ve Karar Alma: Is─▒ haritalar─▒ mek├ónsal ili┼čkilerin g├Âsterilmesinde etkilidir ve i┼č zek├ós─▒, ├ževre ├žal─▒┼čmalar─▒ ve ┼čehir planlama gibi sekt├Ârlerde karar alma s├╝re├žlerine yard─▒mc─▒ olur.

Ger├žek D├╝nya Uygulamalar─▒

Ula┼č─▒m Perakende
Ultralytics YOLOv8 Ula┼č─▒m Is─▒ Haritas─▒ Ultralytics YOLOv8 Perakende Is─▒ Haritas─▒
Ultralytics YOLOv8 Ula┼č─▒m Is─▒ Haritas─▒ Ultralytics YOLOv8 Perakende Is─▒ Haritas─▒

Is─▒ Haritas─▒ Yap─▒land─▒rmas─▒

  • heatmap_alpha: Bu de─čerin (0,0 - 1,0) aral─▒─č─▒nda oldu─čundan emin olun.
  • decay_factor: Bir nesne art─▒k ├žer├ževede olmad─▒ktan sonra ─▒s─▒ haritas─▒n─▒ kald─▒rmak i├žin kullan─▒l─▒r, de─čeri de (0.0 - 1.0) aral─▒─č─▒nda olmal─▒d─▒r.

Ultralytics kullanarak ─▒s─▒ haritalar─▒YOLOv8 ├ľrnek

import cv2

from ultralytics import YOLO, solutions

model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))

# Video writer
video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

# Init heatmap
heatmap_obj = solutions.Heatmap(
    colormap=cv2.COLORMAP_PARULA,
    view_img=True,
    shape="circle",
    classes_names=model.names,
)

while cap.isOpened():
    success, im0 = cap.read()
    if not success:
        print("Video frame is empty or video processing has been successfully completed.")
        break
    tracks = model.track(im0, persist=True, show=False)

    im0 = heatmap_obj.generate_heatmap(im0, tracks)
    video_writer.write(im0)

cap.release()
video_writer.release()
cv2.destroyAllWindows()
import cv2

from ultralytics import YOLO, solutions

model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))

# Video writer
video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

line_points = [(20, 400), (1080, 404)]  # line for object counting

# Init heatmap
heatmap_obj = solutions.Heatmap(
    colormap=cv2.COLORMAP_PARULA,
    view_img=True,
    shape="circle",
    count_reg_pts=line_points,
    classes_names=model.names,
)

while cap.isOpened():
    success, im0 = cap.read()
    if not success:
        print("Video frame is empty or video processing has been successfully completed.")
        break

    tracks = model.track(im0, persist=True, show=False)
    im0 = heatmap_obj.generate_heatmap(im0, tracks)
    video_writer.write(im0)

cap.release()
video_writer.release()
cv2.destroyAllWindows()
import cv2

from ultralytics import YOLO, solutions

model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))

# Video writer
video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

# Define polygon points
region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360), (20, 400)]

# Init heatmap
heatmap_obj = solutions.Heatmap(
    colormap=cv2.COLORMAP_PARULA,
    view_img=True,
    shape="circle",
    count_reg_pts=region_points,
    classes_names=model.names,
)

while cap.isOpened():
    success, im0 = cap.read()
    if not success:
        print("Video frame is empty or video processing has been successfully completed.")
        break

    tracks = model.track(im0, persist=True, show=False)
    im0 = heatmap_obj.generate_heatmap(im0, tracks)
    video_writer.write(im0)

cap.release()
video_writer.release()
cv2.destroyAllWindows()
import cv2

from ultralytics import YOLO, solutions

model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))

# Video writer
video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

# Define region points
region_points = [(20, 400), (1080, 404), (1080, 360), (20, 360)]

# Init heatmap
heatmap_obj = solutions.Heatmap(
    colormap=cv2.COLORMAP_PARULA,
    view_img=True,
    shape="circle",
    count_reg_pts=region_points,
    classes_names=model.names,
)

while cap.isOpened():
    success, im0 = cap.read()
    if not success:
        print("Video frame is empty or video processing has been successfully completed.")
        break

    tracks = model.track(im0, persist=True, show=False)
    im0 = heatmap_obj.generate_heatmap(im0, tracks)
    video_writer.write(im0)

cap.release()
video_writer.release()
cv2.destroyAllWindows()
import cv2

from ultralytics import YOLO, solutions

model = YOLO("yolov8s.pt")  # YOLOv8 custom/pretrained model

im0 = cv2.imread("path/to/image.png")  # path to image file
h, w = im0.shape[:2]  # image height and width

# Heatmap Init
heatmap_obj = solutions.Heatmap(
    colormap=cv2.COLORMAP_PARULA,
    view_img=True,
    shape="circle",
    classes_names=model.names,
)

results = model.track(im0, persist=True)
im0 = heatmap_obj.generate_heatmap(im0, tracks=results)
cv2.imwrite("ultralytics_output.png", im0)
import cv2

from ultralytics import YOLO, solutions

model = YOLO("yolov8n.pt")
cap = cv2.VideoCapture("path/to/video/file.mp4")
assert cap.isOpened(), "Error reading video file"
w, h, fps = (int(cap.get(x)) for x in (cv2.CAP_PROP_FRAME_WIDTH, cv2.CAP_PROP_FRAME_HEIGHT, cv2.CAP_PROP_FPS))

# Video writer
video_writer = cv2.VideoWriter("heatmap_output.avi", cv2.VideoWriter_fourcc(*"mp4v"), fps, (w, h))

classes_for_heatmap = [0, 2]  # classes for heatmap

# Init heatmap
heatmap_obj = solutions.Heatmap(
    colormap=cv2.COLORMAP_PARULA,
    view_img=True,
    shape="circle",
    classes_names=model.names,
)

while cap.isOpened():
    success, im0 = cap.read()
    if not success:
        print("Video frame is empty or video processing has been successfully completed.")
        break
    tracks = model.track(im0, persist=True, show=False, classes=classes_for_heatmap)

    im0 = heatmap_obj.generate_heatmap(im0, tracks)
    video_writer.write(im0)

cap.release()
video_writer.release()
cv2.destroyAllWindows()

Arg├╝manlar Heatmap()

─░sim Tip Varsay─▒lan A├ž─▒klama
classes_names dict None S─▒n─▒f adlar─▒ s├Âzl├╝─č├╝.
imw int 0 G├Âr├╝nt├╝ geni┼čli─či.
imh int 0 Resim y├╝ksekli─či.
colormap int cv2.COLORMAP_JET Is─▒ haritas─▒ i├žin kullan─▒lacak renk haritas─▒.
heatmap_alpha float 0.5 Is─▒ haritas─▒ kaplamas─▒ i├žin alfa kar─▒┼čt─▒rma de─čeri.
view_img bool False G├Âr├╝nt├╝n├╝n ─▒s─▒ haritas─▒ kaplamas─▒yla g├Âr├╝nt├╝lenip g├Âr├╝nt├╝lenmeyece─či.
view_in_counts bool True B├Âlgeye giren nesnelerin say─▒s─▒n─▒n g├Âr├╝nt├╝lenip g├Âr├╝nt├╝lenmeyece─či.
view_out_counts bool True B├Âlgeden ├ž─▒kan nesnelerin say─▒s─▒n─▒n g├Âr├╝nt├╝lenip g├Âr├╝nt├╝lenmeyece─či.
count_reg_pts list veya None None Say─▒m b├Âlgesini tan─▒mlayan noktalar (bir ├žizgi veya bir ├žokgen).
count_txt_color tuple (0, 0, 0) Say─▒lar─▒ g├Âr├╝nt├╝lemek i├žin metin rengi.
count_bg_color tuple (255, 255, 255) Say─▒lar─▒ g├Âr├╝nt├╝lemek i├žin arka plan rengi.
count_reg_color tuple (255, 0, 255) Sayma b├Âlgesi i├žin renk.
region_thickness int 5 B├Âlge ├žizgisinin kal─▒nl─▒─č─▒.
line_dist_thresh int 15 ├çizgi tabanl─▒ say─▒m i├žin mesafe e┼či─či.
line_thickness int 2 ├çizimde kullan─▒lan ├žizgilerin kal─▒nl─▒─č─▒.
decay_factor float 0.99 Is─▒ haritas─▒n─▒n zaman i├žinde yo─čunlu─čunu azaltmak i├žin bozunma fakt├Âr├╝.
shape str "circle" Is─▒ haritas─▒ lekelerinin ┼čekli ('daire' veya 'dikd├Ârtgen').

Arg├╝manlar model.track

─░sim Tip Varsay─▒lan A├ž─▒klama
source im0 None resimler veya videolar i├žin kaynak dizin
persist bool False kareler aras─▒nda kal─▒c─▒ izler
tracker str botsort.yaml ─░zleme y├Ântemi 'bytetrack' veya 'botsort'
conf float 0.3 G├╝ven E┼či─či
iou float 0.5 IOU E┼či─či
classes list None sonu├žlar─▒ s─▒n─▒fa g├Âre filtreleyin, yani classes=0 veya classes=[0,2,3]

Is─▒ Haritas─▒ COLORMAPs

Renk Haritas─▒ Ad─▒ A├ž─▒klama
cv::COLORMAP_AUTUMN Sonbahar renk haritas─▒
cv::COLORMAP_BONE Kemik renk haritas─▒
cv::COLORMAP_JET Jet renk haritas─▒
cv::COLORMAP_WINTER K─▒┼č renk haritas─▒
cv::COLORMAP_RAINBOW G├Âkku┼ča─č─▒ renk haritas─▒
cv::COLORMAP_OCEAN Okyanus renk haritas─▒
cv::COLORMAP_SUMMER Yaz renk haritas─▒
cv::COLORMAP_SPRING Bahar renk haritas─▒
cv::COLORMAP_COOL Harika renk haritas─▒
cv::COLORMAP_HSV HSV (Ton, Doygunluk, De─čer) renk haritas─▒
cv::COLORMAP_PINK Pembe renkli harita
cv::COLORMAP_HOT S─▒cak renk haritas─▒
cv::COLORMAP_PARULA Parula renk haritas─▒
cv::COLORMAP_MAGMA Magma renk haritas─▒
cv::COLORMAP_INFERNO Inferno renk haritas─▒
cv::COLORMAP_PLASMA Plazma renk haritas─▒
cv::COLORMAP_VIRIDIS Viridis renk haritas─▒
cv::COLORMAP_CIVIDIS Cividis renkli harita
cv::COLORMAP_TWILIGHT Alacakaranl─▒k renk haritas─▒
cv::COLORMAP_TWILIGHT_SHIFTED Kayd─▒r─▒lm─▒┼č Alacakaranl─▒k renk haritas─▒
cv::COLORMAP_TURBO Turbo renk haritas─▒
cv::COLORMAP_DEEPGREEN Derin Ye┼čil renk haritas─▒

Bu renk haritalar─▒, verileri farkl─▒ renk g├Âsterimleriyle g├Ârselle┼čtirmek i├žin yayg─▒n olarak kullan─▒l─▒r.



Created 2023-12-07, Updated 2024-06-10
Authors: glenn-jocher (11), IvorZhu331 (1), RizwanMunawar (8), AyushExel (1), 1579093407@qq.com (1)

Yorumlar