Вопрос Нейросеть

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
4 Дек 2022
Сообщения
29
Реакции
3
Может кто то помочь сделать нейронку которая будет определять красный цвет и обводить его в квадрат, что бы окно создавалось от pyautogui и в нем были квадраты, желательно используя tensorflow в реал тайм :FeelsBadMan:
 
использую другую нейронку чтобы сделать свою, почему нет.

952E2D04-E5FD-4D02-B60B-070E0677122D.png


код из примера (если он не работает, не спрашивай у меня почему, не я писал этот код а чатгпт)

Python:
Expand Collapse Copy
import cv2
import tensorflow as tf

# Initialize webcam and create window to display output
cap = cv2.VideoCapture(0)
cv2.namedWindow("Output", cv2.WINDOW_NORMAL)

while True:
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Convert frame to HSV color space
    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

    # Define range of red color in HSV
    lower_red = tf.constant([0, 100, 100], dtype=tf.float32)
    upper_red = tf.constant([10, 255, 255], dtype=tf.float32)

    # Create a mask for the red color
    mask = tf.logical_and(hsv >= lower_red, hsv <= upper_red)

    # Find contours in the mask
    contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

    # Draw circles around contours
    for contour in contours:
        (x, y), radius = cv2.minEnclosingCircle(contour)
        center = (int(x), int(y))
        radius = int(radius)
        cv2.circle(frame, center, radius, (0, 0, 255), 2)

    # Display output
    cv2.imshow("Output", frame)

    # Exit if 'q' is pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release webcam and close window
cap.release()
cv2.destroyAllWindows()
использую другую нейронку чтобы сделать свою, почему нет.

952E2D04-E5FD-4D02-B60B-070E0677122D.png


код из примера (если он не работает, не спрашивай у меня почему, не я писал этот код а чатгпт)

Python:
Expand Collapse Copy
import cv2
import tensorflow as tf

# Initialize webcam and create window to display output
cap = cv2.VideoCapture(0)
cv2.namedWindow("Output", cv2.WINDOW_NORMAL)

while True:
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Convert frame to HSV color space
    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

    # Define range of red color in HSV
    lower_red = tf.constant([0, 100, 100], dtype=tf.float32)
    upper_red = tf.constant([10, 255, 255], dtype=tf.float32)

    # Create a mask for the red color
    mask = tf.logical_and(hsv >= lower_red, hsv <= upper_red)

    # Find contours in the mask
    contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

    # Draw circles around contours
    for contour in contours:
        (x, y), radius = cv2.minEnclosingCircle(contour)
        center = (int(x), int(y))
        radius = int(radius)
        cv2.circle(frame, center, radius, (0, 0, 255), 2)

    # Display output
    cv2.imshow("Output", frame)

    # Exit if 'q' is pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release webcam and close window
cap.release()
cv2.destroyAllWindows()
upd: я вижу что тебе надо чтобы создавало окно и еще чет, просто переведи свою идею на англ, уточни все моменты и напиши в чатгпт, думаю с какого-то раза оно сделает тебе то, что тебе надо.
 
использую другую нейронку чтобы сделать свою, почему нет.

Посмотреть вложение 235190

код из примера (если он не работает, не спрашивай у меня почему, не я писал этот код а чатгпт)

Python:
Expand Collapse Copy
import cv2
import tensorflow as tf

# Initialize webcam and create window to display output
cap = cv2.VideoCapture(0)
cv2.namedWindow("Output", cv2.WINDOW_NORMAL)

while True:
    # Capture frame-by-frame
    ret, frame = cap.read()

    # Convert frame to HSV color space
    hsv = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)

    # Define range of red color in HSV
    lower_red = tf.constant([0, 100, 100], dtype=tf.float32)
    upper_red = tf.constant([10, 255, 255], dtype=tf.float32)

    # Create a mask for the red color
    mask = tf.logical_and(hsv >= lower_red, hsv <= upper_red)

    # Find contours in the mask
    contours, _ = cv2.findContours(mask, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

    # Draw circles around contours
    for contour in contours:
        (x, y), radius = cv2.minEnclosingCircle(contour)
        center = (int(x), int(y))
        radius = int(radius)
        cv2.circle(frame, center, radius, (0, 0, 255), 2)

    # Display output
    cv2.imshow("Output", frame)

    # Exit if 'q' is pressed
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

# Release webcam and close window
cap.release()
cv2.destroyAllWindows()

upd: я вижу что тебе надо чтобы создавало окно и еще чет, просто переведи свою идею на англ, уточни все моменты и напиши в чатгпт, думаю с какого-то раза оно сделает тебе то, что тебе надо.
Через неё пробываю но не получаеться ибо конец постоянно один и тот же, уже 2 день убил на то что бы через неё получить ответ, вот сейчас получилось но ошибка TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
и нейросеть говорит что cpu не поддерживает, хотя процессор i5-8500, и после этого с ней уже нету смысла писать нейросети
 

Пожалуйста, зарегистрируйтесь или авторизуйтесь, чтобы увидеть содержимое.


После запуска (название игры изменил на своё плюс изменил путь до скрина) но ничего не произошло, он запущен но ничего не делает и ошибок нет, игра не в полноэкранном режиме
 
Скрытое содержимое
После запуска (название игры изменил на своё плюс изменил путь до скрина) но ничего не произошло, он запущен но ничего не делает и ошибок нет, игра не в полноэкранном режиме
Я тебе как для примера дал.
Тебя не смущает что тебе красный цвет надо найти, а в коде эта строчка ?
Result = SDK.Compare(img_gray, template_gray)
 
Назад
Сверху Снизу