مشاهده دسته‌بندی‌ها

یاد دادن تصاویر - ساخت مدل‌های هوش مصنوعی سفارشی در اسکرچ

🖼️ یاد دادن تصاویر - ساخت مدل‌های هوش مصنوعی سفارشی در اسکرچ #

The Image Trainer extension brings real machine learning into Scratch.
It lets you train your own AI models to recognize images – toys, faces, hand gestures, objects, or anything visible to the camera – all in real time, right in your browser, with no coding or setup required.
به اندازه کافی ساده برای دانش‌آموزان، و در عین حال قدرتمند برای کلاس‌های درس خلاق.


🌟 مرور کلی #

  • Train Custom Models: Teach the AI to recognize up to 10 different image labels using your camera or stage images.
  • No Pre-training Needed: Start from scratch – show examples, and the AI learns instantly.
  • Real-Time Classification: Get instant feedback as the model identifies what it sees.
  • Save and Load: Download your trained model data and upload it later to continue your project.
  • پیش‌نمایش دوربین را تغییر دهید: نمایش نمای زنده دوربین، پنهان کردن یا آینه‌ای کردن آن برای تطبیق با تنظیمات شما.
  • ورودی را انتخاب کنید: Train and classify from the live camera or directly from the Scratch stage image.

ویژگی‌های کلیدی #

  • Up to 10 custom trainable labels (numbered 1–10).
  • Transfer learning using MobileNet v2 feature extraction for fast training.
  • K-Nearest Neighbors (KNN) classification for quick, efficient recognition.
  • Adjustable “classify” intervals for smooth performance.
  • دارای پیش‌نمایش دوربین، تنظیم شفافیت و کنترل‌های دستگاه.
  • Download and upload learning data to save and restore your trained models.
  • کاملاً در مرورگر کار می‌کند - ایمن و خصوصی.

🚀 نحوه استفاده #

  1. بروید به: pishi.ai/play
  2. بخش افزونه‌ها را باز کنید.
  3. Select the یاد دادن تصاویر extension.
  4. در صورت درخواست، دسترسی به دوربین را مجاز کنید و بررسی کنید که پیش‌نمایش ویدیوی شما نمایش داده شود.
  5. اگر هیچ دوربینی شناسایی نشود، ورودی به طور خودکار به تصویر صحنه تغییر می‌کند.
  6. Training Phase:
    • Hold an object or strike a pose in front of the camera.
    • Click the “train label [1]” block repeatedly (5–20 times) to teach the AI what label 1 looks like.
    • Repeat with different objects or poses for labels 2, 3, 4, etc.
    • The first training may take a moment – be patient! Subsequent trainings are instant.
  7. Classification Phase: Once trained, the AI continuously analyzes the camera and reports which label it sees using the “detected label” block.
  8. Use “when label [1] detected” hat blocks to trigger sprite actions when specific labels are recognized.

نکات

  • Train each label from multiple angles and distances for better accuracy.
  • Use consistent lighting during training and testing.
  • Train at least 5–10 examples per label for reliable recognition.
  • برای کلاس‌های درس یا دستگاه‌های قدیمی‌تر، برای عملکرد روان، دسته‌بندی را در فواصل ۱۰۰ تا ۲۵۰ میلی‌ثانیه شروع کنید.

🧱 بلوک‌ها و توابع #

 

🎓 Training #

train label [LABEL]

Captures the current camera or stage image and adds it as a training example for the selected label.
[LABEL]: choose a label number from 1 to 10.

How it works:

  • Click this block multiple times (5–20 times) while showing the object or pose you want the AI to learn.
  • The more examples you provide, the better the AI will recognize that label.
  • Each click adds one training sample – you’ll see the train count increase.
  • The first training session may take a moment as the model initializes – subsequent trainings are instant.

 

count of label [LABEL] trains
Reports how many training examples have been captured for the specified label.
Use this to track your training progress or display it on screen.

 


🧮 Detection #

detected label
Reports the label number (1–10) that the AI currently recognizes in the camera or stage image.
Returns empty if no label is confidently detected or if no training has been done yet.

مثال: If the AI sees the object you trained as label 3, this block will report “3”.

 

when any label detected
Hat block that triggers when any trained label is detected with confidence above the minimum threshold.
Perfect for starting general reactions to any recognized image.

 

when label [LABEL] detected
Hat block that triggers when the specific label is detected with confidence above the minimum threshold.
[LABEL]: choose a label number from 1 to 10.

Example uses:

  • Train label 1 as “red toy” → when label 1 detected, make sprite say “I see red!”
  • Train label 2 as “thumbs up” → when label 2 detected, play victory sound.
  • Train label 3 as “hand wave” → when label 3 detected, make sprite wave back.

توجه: Hat blocks have a brief timeout (100ms) to prevent multiple rapid triggers.

 


🎯 Confidence #

set minimum confidence [CONFIDENCE]
Sets the minimum confidence score (0–1) required for a label to be reported as detected.
If the AI’s confidence is below this threshold, the detection will be ignored – meaning the “detected label” block will return empty and hat blocks won’t trigger.

0.6 – Default: good balance between accuracy and responsiveness.
0.7–0.9 – Raise it to 0.7-0.9 for stricter, more accurate detection (fewer false positives).
0.3–0.5 – Lower it to 0.3-0.5 for more lenient detection (may increase false positives but catch more borderline cases).

 

minimum confidence
مقدار آستانه اطمینان فعلی را گزارش می‌دهد - برای نمایش آن روی صفحه یا تنظیم پویای آن در طول پروژه مفید است.

Tip: If your project has too many false detections, increase the confidence. If valid detections are being missed, decrease it.


🗑️ Reset and Manage #

reset label: [LABEL]
Clears all training data for the specified label.
[LABEL]: choose a label number from 1 to 10.

A confirmation prompt will appear to prevent accidental deletion.
Use this when you want to retrain a label from scratch.

 

reset all labels
Clears all training data for all labels (1–10).
A confirmation prompt will appear to prevent accidental deletion.
Use this to start a completely fresh training session.

Warning: This deletes all your training work! Make sure to download your learning data first if you want to save it.

 


💾 Save and Load #

download learning data
Downloads your trained model data as a JSON file to your computer.
The filename will be formatted as: imagetrainer-[timestamp].json

Use this to:

  • Save your work before closing the project.
  • Share trained models with classmates or friends.
  • Back up your training progress.

 

upload learning data
Opens a file picker to load previously saved learning data (JSON file).
Once loaded, the AI will immediately recognize the labels it was trained on, without needing to retrain.

Use this to:

  • Continue a project where you left off.
  • Load a model trained by someone else.
  • Switch between different trained models for different projects.

توجه: Only upload JSON files downloaded from the Image Trainer extension.

 


⚙️ کنترل دسته‌بندی #

  • دسته‌بندی [INTERVAL] - انتخاب کنید که تشخیص چند وقت یکبار انجام شود:
    • هر بار که این بلوک اجرا می‌شود
    • پیوسته، بدون وقفه
    • پیوسته، هر ۵۰ تا ۲۵۰۰ میلی‌ثانیه
  • دسته‌بندی را [خاموش/روشن] کن - شروع یا توقف تشخیص پیوسته.
  • فاصله زمانی دسته‌بندی - فاصله زمانی فعلی را بر حسب میلی‌ثانیه گزارش می‌دهد.
  • دسته‌بندی پیوسته - گزارش می‌دهد که تشخیص پیوسته «روشن» یا «خاموش» است.
  • انتخاب تصویر ورودی [دوربین/صحنه] - دوربین یا صحنه را انتخاب کنید.
  • تصویر ورودی - منبع ورودی فعال را گزارش می‌دهد.

🎥 کنترل ویدیو #

  • دسته‌بندی [INTERVAL] - انتخاب کنید که تشخیص چند وقت یکبار انجام شود:
    • هر بار که این بلوک اجرا می‌شود
    • پیوسته، بدون وقفه
    • پیوسته، هر ۵۰ تا ۲۵۰۰ میلی‌ثانیه
  • دسته‌بندی را [خاموش/روشن] کن - شروع یا توقف تشخیص پیوسته.
  • فاصله زمانی دسته‌بندی - فاصله زمانی فعلی را بر حسب میلی‌ثانیه گزارش می‌دهد.
  • دسته‌بندی پیوسته - گزارش می‌دهد که تشخیص پیوسته «روشن» یا «خاموش» است.
  • انتخاب تصویر ورودی [دوربین/صحنه] - دوربین یا صحنه را انتخاب کنید.
  • تصویر ورودی - منبع ورودی فعال را گزارش می‌دهد.

🎓 کاربردهای آموزشی #

  • Introduce Machine Learning Concepts: Students learn how AI models are trained using examples, not rules.
  • Teach classification, pattern recognition, and the importance of training data quality.
  • Explore transfer learning – how pre-trained models (MobileNet) can be adapted for new tasks.
  • Discuss overfitting, underfitting, and model accuracy through hands-on experimentation.
  • Create interactive games and tools that respond to real-world objects, gestures, or faces.
  • Build accessible input methods – control projects with hand signs, facial expressions, or custom gestures.

🎮 پروژه‌های نمونه #

  • Rock Paper Scissors AI: Train labels 1, 2, 3 for rock, paper, scissors – play against the computer!
  • Color Sorter: Train labels for different colored objects – sprite reacts to each color.
  • Custom Gesture Controller: Train hand poses (thumbs up, peace sign, fist) to control sprite movement.
  • Pet Recognition: Train labels for different pets or toys – make a sprite greet each one differently.
  • Smart Classroom Tool: Train labels for “hand raised,” “question,” “ready” – automate classroom responses.
  • Emotion Detector: Train labels for happy, sad, surprised faces – create an emotion-responsive character.
  • Object Finder Game: Train labels for hidden objects – search and find game with AI validation.

🧩 خودتان امتحان کنید: pishi.ai/play

 


🔧 نکات و عیب‌یابی #

  • دوربین یافت نشد؟
    • مطمئن شوید که دوربین شما متصل است و اجازه مرورگر داده شده است.
    • اگر دوربین مسدود شده است، آن را در تنظیمات سایت مرورگر خود فعال کنید و صفحه را دوباره بارگذاری کنید.
    • در حین بارگذاری افزونه، اگر هیچ دوربینی شناسایی نشود، ورودی به طور خودکار به تصویر صحنه تغییر می‌کند تا بتوانید همچنان ویژگی‌های FaceMesh را آزمایش کنید.
  • تشخیص داده نشد؟
    دسته‌بندی پیوسته: از این گزارشگر برای بررسی فعال بودن دسته‌بندی استفاده کنید.
    • اگر فعال است، روشنایی را بهبود بخشیده و مستقیماً رو به دوربین باشید.
    دسته‌بندی را [روشن] کن: از این بلوک استفاده کنید، اگر دسته‌بندی فعال نیست، سپس وضعیت طبقه‌بندی را با گزارشگر فوق دوباره بررسی کنید.
    • در حالت ورودی دوربین، وقتی دوربین خاموش است، دسته‌بندی نیز متوقف می‌شود - باید ویدیو را دوباره روشن کنید یا ورودی را به صحنه تغییر دهید.
    • در حالت ورودی صحنه، سیستم هر آنچه را که روی صحنه قابل مشاهده است طبقه‌بندی می‌کند - پس‌زمینه‌ها، اسپرایت‌ها یا تصاویر. می‌توانید ویدیو را کاملاً خاموش کنید و همچنان تصاویر صحنه را پردازش کنید.
    • حالت صحنه کندتر از ورودی دوربین است، بنابراین برای نتایج روان‌تر با استفاده از این بلوک، فاصله زمانی دسته‌بندی خود را کاهش دهید (مثلاً بین ۱۰۰ تا ۲۵۰ میلی‌ثانیه): دسته‌بندی [INTERVAL]
    • در حالت صحنه، نشانه‌های «چپ» و «راست» جابجا می‌شوند زیرا تصویر صحنه آینه‌ای نیست - فضای مختصات نشان دهنده یک نمای واقعی (غیر آینه‌ای) است.
    • دسته‌بندی همچنین می‌تواند هنگام استفاده از بلوک‌هایی مانند موارد زیر به طور خودکار مجدداً راه‌اندازی شود:
    ویدیو را [روشن] کن / دسته‌بندی [INTERVAL] / دوربین [CAMERA] را انتخاب کن. / انتخاب تصویر ورودی [دوربین/صحنه].
  • نمای وارونه؟
    ویدیو را [روشن و آینه‌ای] کن: از این برای نمایش دوربین بدون آینه‌سازی استفاده کنید. حالت «روشن» مانند یک سلفی آینه‌ای می‌شود؛ حالت «روشن و آینه‌ای» جهت واقعی چپ/راست را نشان می‌دهد.
  • کند یا دارای تاخیر؟
    از فواصل دسته‌بندی بین ۱۰۰ تا ۲۵۰ میلی‌ثانیه استفاده کنید یا سایر تب‌های مرورگر را ببندید تا بار پردازش کاهش یابد.
  • هشدار WebGL2؟
    فایرفاکس یا دستگاه جدیدتری که از شتاب گرافیکی WebGL2 پشتیبانی می‌کند را امتحان کنید.
  • به جای دوربین، صحنه را تحلیل کن؟
    انتخاب تصویر ورودی [صحنه]: از این گزینه برای تحلیل تصویر صحنه Scratch به جای تصویر زنده دوربین استفاده کنید.

🖼️ Image Trainer Specific Tips #

  • Not detecting accurately? Train more examples (aim for 10–20 per label) from different angles.
  • False positives? Increase the minimum confidence threshold (try 0.7–0.8).
  • Missing detections? Lower the confidence threshold (try 0.4–0.5) or train more diverse examples.
  • First training slow? This is normal – MobileNet loads on the first train. Subsequent trainings are instant.
  • Want to start fresh? Use “reset all labels” – but download your data first if you want to keep it!
  • Lighting matters: Train and test in similar lighting conditions for best results.
  • Background clutter? Use plain backgrounds during training for cleaner recognition.

🔒 حریم خصوصی و ایمنی #

  • همه چیز به صورت محلی در مرورگر شما اجرا می‌شود.
  • هیچ تصویر یا ویدیویی در هیچ کجا آپلود نمی‌شود.
  • فایل‌های مدل ممکن است یک بار برای استفاده آفلاین دانلود شوند.
  • قبل از استفاده از دوربین، همیشه از معلم یا والدین خود اجازه بگیرید.
  • در هر زمان، با خیال راحت ویدیو را [خاموش] کن.

Image Trainer Privacy Notes:

  • Your training data stays on your computer – nothing is uploaded to servers.
  • Downloaded learning data is stored locally as a JSON file – you control where it goes.
  • No personal images are sent anywhere – all training and classification happen in your browser.

🧪 اطلاعات فنی #

  • Base Model: MobileNet v2
  • چارچوب: TensorFlow.js + KNN Classifier – runs fully in-browser using WebGL2 acceleration
  • Technique: Transfer learning + K-Nearest Neighbors classification
  • Labels: 10 trainable labels (1–10)
  • Training: Instant after first initialization – no server required
  • ورودی‌ها: دوربین یا بوم صحنه
  • Default confidence: 0.6 (adjustable 0–1)
  • Model loading: Local files or bundled with extension
  • Data format: JSON
  • نیازمند: WebGL2 برای بهترین عملکرد

🔗 افزونه‌های مرتبط #

  • 🏫 ماشین آموزش‌پذیر گوگل – import pre-trained models from Teachable Machine
  • 😎 تشخیص صورت - تشخیص نقاط کلیدی صورت
  • 🖐️ تشخیص دست - تشخیص نقاط کلیدی دست
  • 🕺 تشخیص بدن - ردیابی حالات بدن

🖼️ Comparison: Image Trainer vs. Google Teachable Machine Extension #

Both extensions let you use custom-trained AI models in Scratch – but they differ in where and how you train the model.

ویژگی یاد دادن تصاویر ماشین آموزش‌پذیر گوگل
Training Location Train directly inside Scratch – instant and integrated. Train on Teachable Machine website, export, then import into Scratch.
Ease of Use All-in-one – no external tools needed. Requires switching between TM website and Scratch.
Labels Supported 10 labels (1–10) Unlimited labels (depends on your TM model)
Training Speed Instant after first load – add examples with one click. Slower – must train on TM website, wait for processing, export, and import.
Model Portability Download/upload JSON files for saving and sharing models. Import pre-trained TM models via URL or upload.
Customization Limited to KNN + MobileNet v2 (fast and lightweight). Full Teachable Machine options (deep learning, custom architectures).
Best For Quick, iterative training during live projects – great for classrooms and beginners. Advanced projects requiring more complex models or many labels.
حریم خصوصی 100% local – all training stays in your browser. Training on TM website (Google) – model data may be processed externally.
تمرکز آموزشی Hands-on introduction to ML – see training happen in real time. Learn professional ML workflows – training, exporting, deploying.

↔ برای مشاهده جدول کامل در موبایل، صفحه را به چپ یا راست بکشید

 

💡 Why Choose Image Trainer? #

Image Trainer is perfect for live, interactive learning. Students train, test, and iterate instantly – no tab-switching or waiting for uploads.

  • Immediate feedback loop for experimentation.
  • Fully self-contained – no external accounts or websites.
  • Privacy-focused – all data stays on your device.
  • Ideal for rapid prototyping and classroom demos.

💡 Why Choose Teachable Machine? #

Teachable Machine is better for advanced or pre-planned models.

  • More labels and more powerful training options.
  • Share models via URLs – easier collaboration.
  • Access to Google’s training infrastructure for more complex models.

به طور خلاصه:
یاد دادن تصاویر = instant, integrated, beginner-friendly ML inside Scratch.
Teachable Machine = professional workflow for complex, pre-trained models.


📚 اطلاعات بیشتر #


پیمایش به بالا