منصة الذكاء الاصطناعي التفاعلية
التطبيق العملي للمنهج الدراسي باستخدام Python & AI Libraries
تطبيقات برمجية
رؤية حاسوبية
الأسبوع الأول: أساسيات البيانات
استخدام مكتبات Pandas و NumPy لتجهيز البيانات.
المكتبات المطلوبة: pip install pandas numpy
import numpy as np
import pandas as pd
# إنشاء بيانات درجات الطلاب
data = np.random.randint(50, 100, size=(10, 4))
df = pd.DataFrame(data, columns=['Math', 'Science', 'AI', 'Programming'])
# العمليات الإحصائية
print("---- متوسط الدرجات ----")
print(df.mean())
# تصفية المتفوقين
print("\n---- الطلاب المتميزون في AI (>90) ----")
print(df[df['AI'] > 90])
الخوارزميات (BFS)
خوارزمية البحث بالعرض (Breadth-First Search).
graph = {
'A': ['B', 'C'], 'B': ['D', 'E'], 'C': ['F'],
'D': [], 'E': ['F'], 'F': []
}
def bfs(graph, start):
visited, queue = [], [start]
while queue:
vertex = queue.pop(0)
if vertex not in visited:
visited.append(vertex)
print(vertex, end=" -> ")
queue.extend([n for n in graph[vertex] if n not in visited])
print("مسار البحث:")
bfs(graph, 'A')
معالجة الصور (Basic)
import cv2
import numpy as np
# إنشاء صورة سوداء ورسم مربع
img = np.zeros((200, 200, 3), dtype="uint8")
cv2.rectangle(img, (50, 50), (150, 150), (0, 255, 0), 3)
# تحويل لرمادي وكشف الحواف
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 100, 200)
print("تمت المعالجة (استخدم cv2.imshow للعرض).")
مختبر الذكاء الاصطناعي التفاعلي
تنبيه: هذه الأكواد تتطلب كاميرا ويب ومكتبات opencv-python mediapipe
1. شبكة الوجه (Face Mesh)
import cv2
import mediapipe as mp
mp_face_mesh = mp.solutions.face_mesh
mp_drawing = mp.solutions.drawing_utils
cap = cv2.VideoCapture(0)
with mp_face_mesh.FaceMesh(refine_landmarks=True) as face_mesh:
while cap.isOpened():
success, image = cap.read()
if not success: continue
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
results = face_mesh.process(image)
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
if results.multi_face_landmarks:
for face_landmarks in results.multi_face_landmarks:
mp_drawing.draw_landmarks(
image=image, landmark_list=face_landmarks,
connections=mp_face_mesh.FACEMESH_TESSELATION)
cv2.imshow('Face Mesh', image)
if cv2.waitKey(5) & 0xFF == ord('q'): break
cap.release()
2. الرسام الافتراضي (Virtual Painter)
import cv2
import mediapipe as mp
import numpy as np
mp_hands = mp.solutions.hands
hands = mp_hands.Hands()
cap = cv2.VideoCapture(0)
imgCanvas = np.zeros((480, 640, 3), np.uint8)
px, py = 0, 0
while True:
_, img = cap.read()
img = cv2.flip(img, 1)
results = hands.process(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
if results.multi_hand_landmarks:
for lm in results.multi_hand_landmarks:
point = lm.landmark[8]
h, w, c = img.shape
cx, cy = int(point.x * w), int(point.y * h)
if px == 0 and py == 0: px, py = cx, cy
cv2.line(imgCanvas, (px, py), (cx, cy), (255,0,255), 10)
px, py = cx, cy
img = cv2.addWeighted(img, 0.5, imgCanvas, 0.5, 0)
cv2.imshow("Painter", img)
if cv2.waitKey(1) == ord('q'): break
تعلم الآلة (SVM)
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
iris = datasets.load_iris()
X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target)
model = SVC(kernel='linear')
model.fit(X_train, y_train)
print(f"Accuracy: {model.score(X_test, y_test) * 100:.2f}%")
التعلم العميق (Neural Networks)
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
model = Sequential([
Dense(16, activation='relu', input_shape=(4,)),
Dense(8, activation='relu'),
Dense(3, activation='softmax')
])
model.summary()
- الحصول على الرابط
- X
- بريد إلكتروني
- التطبيقات الأخرى
- الحصول على الرابط
- X
- بريد إلكتروني
- التطبيقات الأخرى