モデル概要
モデル特徴
モデル能力
使用事例
🚀 YOLOv8s株式市場リアルタイムパターン検出モデル
このモデルは、YOLOフレームワークに基づく物体検出モデルです。リアルタイムで株式市場の取引データのスクリーンキャプチャから様々なチャートパターンを検出し、トレーダーや投資家がチャートパターンの分析を自動化し、適切な意思決定を行うのに役立ちます。

🚀 クイックスタート
このモデルを使用するには、必要なライブラリをインストールします。
pip install mss==10.0.0 opencv-python==4.11.0.86 numpy ultralytics==8.3.94 openpyxl==3.1.5
💻 使用例
基本的な使用法
import os
import mss # type: ignore
import cv2
import numpy as np
import time
import glob
from ultralytics import YOLO
from openpyxl import Workbook
# Get the user's home directory
home_dir = os.path.expanduser("~")
# Define dynamic paths
save_path = os.path.join(home_dir, "yolo_detection")
screenshots_path = os.path.join(save_path, "screenshots")
detect_path = os.path.join(save_path, "runs", "detect")
# Ensure necessary directories exist
os.makedirs(screenshots_path, exist_ok=True)
os.makedirs(detect_path, exist_ok=True)
# Define pattern classes
classes = ['Head and shoulders bottom', 'Head and shoulders top', 'M_Head', 'StockLine', 'Triangle', 'W_Bottom']
# Load YOLOv8 model
model_path = "model.pt"
if not os.path.exists(model_path):
raise FileNotFoundError(f"Model file not found: {model_path}")
model = YOLO(model_path)
# Define screen capture region
monitor = {"top": 0, "left": 683, "width": 683, "height": 768}
# Create an Excel file
excel_file = os.path.join(save_path, "classification_results.xlsx")
wb = Workbook()
ws = wb.active
ws.append(["Timestamp", "Predicted Image Path", "Label"]) # Headers
# Initialize video writer
video_path = os.path.join(save_path, "annotated_video.mp4")
fourcc = cv2.VideoWriter_fourcc(*"mp4v")
fps = 0.5 # Adjust frames per second as needed
video_writer = None
with mss.mss() as sct:
start_time = time.time()
last_capture_time = start_time # Track the last capture time
frame_count = 0
while True:
# Continuously capture the screen
sct_img = sct.grab(monitor)
img = np.array(sct_img)
img = cv2.cvtColor(img, cv2.COLOR_BGRA2BGR)
# Check if 60 seconds have passed since last YOLO prediction
current_time = time.time()
if current_time - last_capture_time >= 60:
# Take screenshot for YOLO prediction
timestamp = time.strftime("%Y-%m-%d %H:%M:%S")
image_name = f"predicted_images_{timestamp}_{frame_count}.png"
image_path = os.path.join(screenshots_path, image_name)
cv2.imwrite(image_path, img)
# Run YOLO model and get save directory
results = model(image_path, save=True)
predict_path = results[0].save_dir if results else None
# Find the latest annotated image inside predict_path
if predict_path and os.path.exists(predict_path):
annotated_images = sorted(glob.glob(os.path.join(predict_path, "*.jpg")), key=os.path.getmtime, reverse=True)
final_image_path = annotated_images[0] if annotated_images else image_path
else:
final_image_path = image_path # Fallback to original image
# Determine predicted label
if results and results[0].boxes:
class_indices = results[0].boxes.cls.tolist()
predicted_label = classes[int(class_indices[0])]
else:
predicted_label = "No pattern detected"
# Insert data into Excel (store path instead of image)
ws.append([timestamp, final_image_path, predicted_label])
# Read the image for video processing
annotated_img = cv2.imread(final_image_path)
if annotated_img is not None:
# Add timestamp and label text to the image
font = cv2.FONT_HERSHEY_SIMPLEX
cv2.putText(annotated_img, f"{timestamp}", (10, 30), font, 0.7, (0, 255, 0), 2, cv2.LINE_AA)
cv2.putText(annotated_img, f"{predicted_label}", (10, 60), font, 0.7, (0, 255, 255), 2, cv2.LINE_AA)
# Initialize video writer if not already initialized
if video_writer is None:
height, width, layers = annotated_img.shape
video_writer = cv2.VideoWriter(video_path, fourcc, fps, (width, height))
video_writer.write(annotated_img)
print(f"Frame {frame_count}: {final_image_path} -> {predicted_label}")
frame_count += 1
# Update the last capture time
last_capture_time = current_time
# Save the Excel file periodically
wb.save(excel_file)
# If you want to continuously display the screen, you can add this line
cv2.imshow("Screen Capture", img)
# Break if 'q' is pressed (you can exit the loop this way)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release video writer
if video_writer is not None:
video_writer.release()
print(f"Video saved at {video_path}")
# Remove all files in screenshots directory
for file in os.scandir(screenshots_path):
os.remove(file.path)
os.rmdir(screenshots_path)
print(f"Results saved to {excel_file}")
# Close OpenCV window
cv2.destroyAllWindows()
✨ 主な機能
- リアルタイムで株式市場のチャートパターンを検出します。
- 検出されたパターンをログに記録し、検出された画像に注釈を付け、結果をExcelファイルに保存し、時間経過に伴う検出パターンのビデオを生成します。
- トレーダーが戦略を最適化し、取引決定を自動化し、市場トレンドにリアルタイムで対応できるようにします。
📚 ドキュメント
モデルの詳細
モデルの説明
このモデルは、株式市場のスクリーンキャプチャ内の重要なチャートパターンをリアルタイムで検出できます。株式市場は急速に変化するため、このモデルの機能により、ユーザーはタイムリーな洞察を得て、迅速かつ正確に意思決定を行うことができます。
このモデルは、株式市場の取引チャートのスクリーンキャプチャで動作するように設計されています。'Head and shoulders bottom'、'Head and shoulders top'、'M_Head'、'StockLine'、'Triangle'、'W_Bottom'などのパターンを検出できます。トレーダーは、戦略を最適化し、取引決定を自動化し、市場トレンドにリアルタイムで対応できます。
このモデルをライブトレードシステムに統合する場合やカスタマイズに関する問い合わせは、info@foduu.comまでお問い合わせください。
属性 | 详情 |
---|---|
開発元 | FODUU AI |
モデルタイプ | 物体検出 |
タスク | スクリーンキャプチャからの株式市場パターン検出 |
サポートされるラベル
['Head and shoulders bottom', 'Head and shoulders top', 'M_Head', 'StockLine', 'Triangle', 'W_Bottom']
用途
直接的な使用
このモデルは、株式市場のチャートのスクリーンキャプチャに対してリアルタイムのパターン検出に使用できます。検出されたパターンをログに記録し、検出された画像に注釈を付け、結果をExcelファイルに保存し、時間経過に伴う検出パターンのビデオを生成できます。
下流の使用
このモデルのリアルタイム機能を利用して、取引戦略を自動化し、特定のパターンに対するアラートを生成し、全体的な取引パフォーマンスを向上させることができます。
トレーニングデータ
この株式市場モデルは、9000枚のトレーニング画像と800枚の検証画像からなるカスタムデータセットで微調整されています。
適用範囲外の使用
このモデルは、株式市場のパターン検出以外の物体検出タスクや、スクリーンキャプチャデータの範囲外のシナリオには設計されていません。
バイアス、リスク、および制限事項
- チャートのスタイル、スクリーン解像度、市場条件の変化により、パフォーマンスが影響を受ける可能性があります。
- 急激な市場変動や取引データのノイズが精度に影響を与える可能性があります。
- トレーニングデータに十分に表されていない市場固有のパターンの検出には課題がある可能性があります。
推奨事項
ユーザーは、このモデルの制限事項と潜在的なバイアスを認識しておく必要があります。実際の取引決定にこのモデルを展開する前に、過去のデータとライブ市場条件でのテストと検証を行うことをお勧めします。
🔧 技術詳細
このモデルは、YOLO (You Only Look Once) フレームワークに基づいており、様々なチャートパターンをリアルタイムで検出するために微調整されています。モデルは、多様なデータセットで訓練されており、ライブトレードシナリオでの株式市場パターンの検出と分類に高い精度を達成しています。
📄 ライセンス
ドキュメントにライセンス情報は記載されていません。
モデルの問い合わせ
問い合わせや貢献については、info@foduu.comまでお問い合わせください。
@ModelCard{
author = {Nehul Agrawal,
Pranjal Singh Thakur, Priyal Mehta and Arjun Singh},
title = {YOLOv8s Stock Market Pattern Detection from Live Screen Capture},
year = {2023}
}











