
[英]Linux Jupyter Notebook : "The kernel appears to have died. It will restart automatically"
[英]Opencv feed keeps loading after use, jupyter notebook kernel died. I am guessing that the opencv has a problem but I don't know how to solve it
Python 意外退出。 内核似乎已经死了。 它会自动重启。
(设备:MacBook Air M1)我正在收集用于训练动作检测程序的关键点( https://youtu.be/doDUihpj6ro ):
帽 = cv2.VideoCapture(0)
将 mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) 的 mediapipe 模型设置为整体:
for action in actions:
# Loop through sequences aka videos
for sequence in range(no_sequences):
# Loop through video length aka sequence length, each frame, 30 frames of keypoints for each video
for frame_num in range(sequence_length):
# Read feed
ret, frame = cap.read()
# Make detections
image, results = mediapipe_detection(frame, holistic)
打印结果
# Draw landmarks
draw_styled_landmarks(image, results)
# NEW Apply wait logic
if frame_num == 0:
cv2.putText(image, 'STARTING COLLECTION', (120,200),
cv2.FONT_HERSHEY_SIMPLEX, 1, (0,255, 0), 4, cv2.LINE_AA)
cv2.putText(image, 'Collecting frames for {} Video Number {}'.format(action, sequence), (15,12),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 1, cv2.LINE_AA)
# Show to screen
cv2.imshow('OpenCV Feed', image)
cv2.waitKey(1200)
else:
cv2.putText(image, 'Collecting frames for {} Video Number {}'.format(action, sequence), (15,12),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 1, cv2.LINE_AA)
# Show to screen
cv2.imshow('OpenCV Feed', image)
# NEW Export keypoints
keypoints = extract_keypoints(results)
npy_path = os.path.join(DATA_PATH, action, str(sequence), str(frame_num))
np.save(npy_path, keypoints)
# Break gracefully
if cv2.waitKey(10) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
在我运行此代码并记录我的数据(视频)后,我的 opencv 提要不断加载(Macbook 中的彩虹圈)。 当我运行下面的单元格时,python 意外退出,内核似乎已经死了。
从 sklearn.model_selection 导入 train_test_split
从 tensorflow.keras.utils 导入到_categorical
我在网上阅读,遇到 opencv 问题的人通过创建新的 conda 环境解决了这个问题。 这是我在终端中尝试并得到的: conda create --name myenv opencv-env python=3.6 收集包元数据(current_repodata.json):完成 解决环境:来自 current_repodata.json 的 repodata 失败,将重试下一个 repodata 源。 收集包元数据(repodata.json):完成解决环境:失败
PackagesNotFoundError:当前频道不提供以下软件包:
当前频道:
要搜索可能提供您正在寻找的 conda 包的备用频道,请导航到
https://anaconda.org
并使用页面顶部的搜索栏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.