python - Simple dlib program makes my computer crash -
i'm running simple program python 3.6 64 bit on pycharm 64bit.
however 2 out of 3 times run it, computer freezes, can't else , have turn off pressing power button.
i suspect use ram i'm not sure comes from.
here code :
from imutils import face_utils import numpy np import argparse import imutils import dlib import cv2 detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat") image = cv2.imread("obama.jpg") gray = cv2.cvtcolor(image, cv2.color_bgr2gray) rects = detector(gray, 1) (i, rect) in enumerate(rects): shape = predictor(gray, rect) shape = face_utils.shape_to_np(shape) (x, y, w, h) = face_utils.rect_to_bb(rect) cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2) cv2.puttext(image, "face #{}".format(i + 1), (x - 10, y - 10),cv2.font_hershey_simplex, 0.5, (0, 255, 0), 2) (x, y) in shape: cv2.circle(image, (x, y), 1, (0, 0, 255), -1) cv2.imshow("output", image) cv2.waitkey(0)
well cdarke found out passing battery usage "high performances" solved problem.
Comments
Post a Comment