پایتون ( Machine Learning | Data Science )
23.8K subscribers
495 photos
63 videos
104 files
357 links
◀️اینجا با تمرین و چالش با هم پایتون رو یاد می گیریم

بانک اطلاعاتی پایتون
پروژه / code/ cheat sheet
+ویدیوهای آموزشی

+کتابهای پایتون
تبلیغات:
@alloadv

🔁ادمین :
@maryam3771
Download Telegram
import tkinter as tk
from tkinter import filedialog
from PIL import Image, ImageTk, ImageOps
import torch
import torchvision.transforms as transforms
import numpy as np

# تعریف مدل و بارگذاری وزن‌های آموزش‌دیده شده
class ComplexNN(nn.Module):
init__init__(self):
super(ComplexNNinit__init__()
self.conv1 = nn.Conv2d(1, 32, kernel_size=3, stride=1, padding=1)
self.conv2 = nn.Conv2d(32, 64, kernel_size=3, stride=1, padding=1)
self.pool = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)
self.fc1 = nn.Linear(64 * 7 * 7, 128)
self.fc2 = nn.Linear(128, 10)
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = x.view(-1, 64 * 7 * 7)
x = F.relu(self.fc1(x))
x = self.fc2(x)
return x

net = ComplexNN()
net.load_state_dict(torch.load('model.pth'))
net.eval()

# تعریف تبدیل‌ها
transform = transforms.Compose([
transforms.Grayscale(num_output_channels=1),
transforms.Resize((28, 28)),
transforms.ToTensor(),
transforms.Normalize((0.5,), (0.5,))
])

# ساخت برنامه tkinter
class AIApp:
def init(self, root):
self.root = root
self.root.title("AI Number Recognizer")

self.label = tk.Label(root, text="Load an image to recognize the number")
self.label.pack()

self.button = tk.Button(root, text="Load Image", command=self.load_image)
self.button.pack()

self.canvas = tk.Canvas(root, width=200, height=200)
self.canvas.pack()

self.result_label = tk.Label(root, text="")
self.result_label.pack()

def load_image(self):
file_path = filedialog.askopenfilename()
if file_path:
image = Image.open(file_path)
self.show_image(image)
number = self.predict_number(image)
self.result_label.config(text=f"Predicted Number: {number}")

def show_image(self, image):
image = ImageOps.fit(image, (200, 200), Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
self.canvas.create_image(0, 0, anchor=tk.NW, image=photo)
self.canvas.image = photo

def predict_number(self, image):
image = transform(image).unsqueeze(0)
output = net(image)
_, predicted = torch.max(output.data, 1)
return predicted.item()

root = tk.Tk()
app = AIApp(root)
root.mainloop()

8. توضیحات تکمیلی 📚

این برنامه یک شبکه عصبی پیچیده برای تشخیص اعداد دست‌نویس ساخته شده با PyTorch را در یک رابط کاربری ساده با استفاده از tkinter تلفیق می‌کند. کاربران می‌توانند یک تصویر دست‌نویس از عددی را بارگذاری کرده و برنامه به طور خودکار عدد موجود در تصویر را تشخیص می‌دهد.

مزایا و کاربردهای استفاده از این سیستم AI

1. بهبود دقت: استفاده از شبکه عصبی پیچیده دقت بالایی در تشخیص اعداد دست‌نویس دارد.
2. انعطاف‌پذیری: می‌توان مدل را برای تشخیص اشیاء و الگوهای دیگر آموزش داد.
3. سهولت استفاده: رابط کاربری ساده به کاربران امکان می‌دهد به راحتی از مدل استفاده کنند


#یادگیری_ماشین #شبکه_عصبی #هوش_مصنوعی #پایتون #PyTorch #AI #Code

🆔 @Python4all_pro
👍51
Microsoft is offering Generative #AI for Beginners for FREE!

- 12 Weeks
- 21 Lessons
- Content is up to date

https://github.com/microsoft/generative-ai-for-beginners/tree/main?WT.mc_id=academic-105485-koreyst

🆔 @Python4all_pro
2👍2
Automatically Generate Image CAPTCHAs with Python for Enhanced Security



#Python #DataScience
#MachineLearning #AI


🆔 @Python4all_pro
2🔥1
extracts data from documents using #AI


https://github.com/katanaml/sparrow



📱 @Python4all_pro
Please open Telegram to view this post
VIEW IN TELEGRAM
➡️BYTEDANCE has released the TRAE AGENT-LLM-agent for automating tasks in the field of software engineering.

Planning and use of tools from the box

He knows how to refract, debate, understand the code

Completely autonomous

Absolutely open code

Great base if you are building something with #AI.


git clone https://github.com/bytedance/trae-agent.git
cd trae-agent
uv venv
uv sync --all-extras


https://github.com/bytedance/trae-agent


📱 @Python4all_pro
Please open Telegram to view this post
VIEW IN TELEGRAM
1