小编Par*_*ain的帖子

围绕从 mediapipe 手部地标检测返回的所有点创建一个矩形,就像 cv2.boundingrect 一样

我正在使用以下代码来使用 mediapipe 检测手部地标

import cv2
import mediapipe as mp

mphands = mp.solutions.hands
hands = mphands.Hands()
mp_drawing = mp.solutions.drawing_utils
cap = cv2.VideoCapture(0)

while True:
    _, frame = cap.read()
    framergb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    result = hands.process(framergb)
    hand_landmarks = result.multi_hand_landmarks
    if hand_landmarks:
        for handLMs in hand_landmarks:
            mp_drawing.draw_landmarks(frame, handLMs, mphands.HAND_CONNECTIONS)
            print("\n\n\n")
    cv2.imshow("Frame", frame)

    cv2.waitKey(1)
Run Code Online (Sandbox Code Playgroud)

我只想在探测器返回的所有点周围有一个矩形请告诉我是否有任何方法可以在 mediapipe 中内置或使用 opencv

python opencv mediapipe

5
推荐指数
1
解决办法
7312
查看次数

Keras-rl2错误AttributeError:“顺序”对象没有属性“_compile_time_distribution_strategy”

当使用下面的代码时,我收到此错误 AttributeError: 'Sequential' object has no attribute '_compile_time_distribution_strategy' with keras-rl2。

我搜索了整个互联网但找不到解决方案。

import gym
import tensorflow
print("Import Done")

env = gym.make("CartPole-v0")
states = env.observation_space.shape[0]
print(env.observation_space.shape)
actions = env.action_space.n
print(actions)

print(states)

print(env.observation_space)
print(env.action_space)



def build_model(nstates, nactions):
    model = tensorflow.keras.models.Sequential()
    model.add(tensorflow.keras.layers.Flatten(input_shape=(1, states)))
    model.add(tensorflow.keras.layers.Dense(24, activation='relu'))
    model.add(tensorflow.keras.layers.Dense(24, activation='relu'))
    model.add(tensorflow.keras.layers.Dense(actions, activation='linear'))
    return model


model = build_model(states, actions)
# print(model.summary())

from rl.agents import DQNAgent
from rl.policy import BoltzmannQPolicy
from rl.memory import SequentialMemory


def build_agent(model, actions):
    policy = BoltzmannQPolicy()
    memory = SequentialMemory(limit=50000, window_length=1)
    dqn = DQNAgent(model=model, memory=memory, policy=policy, …
Run Code Online (Sandbox Code Playgroud)

tensorflow keras-rl

4
推荐指数
1
解决办法
4885
查看次数

标签 统计

keras-rl ×1

mediapipe ×1

opencv ×1

python ×1

tensorflow ×1