@Foxford12

Что делать если при запуске кода в PyCharm выводит: Process finished with exit code -1073741795 (0xC000001D)?

Я скачал Pycarm 2017.3.7 на windows 7 32-bit когда запускаю код выводится только Process finished with exit code -1073741795 (0xC000001D) на windows 10 64-bit все работало стабильно что делать?

import numpy as np
import cv2
import time
import datetime as dt
from time import sleep
import smtplib
import os
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
from platform import python_version

"""
Распознование
"""

prototxt_path = "models\MobileNetSSD_deploy.prototxt"
model_path = "models\MobileNetSSD_deploy.caffemodel"
min_confidence = 0.2
classes = ["background", "aeroplane", "bicycle", "bird", "boat",
		   "bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
		   "dog", "horse", "motorbike", "person", "pottedplant", "sheep",
		   "sofa", "train", "tvmonitor"]

np.random.seed(543210)
colors = np.random.uniform(0, 255, size=(len(classes), 3))

net = cv2.dnn.readNetFromCaffe(prototxt_path, model_path)

cap = cv2.VideoCapture(0)
pip = 1
time = dt.datetime.now()
time_15 = time+dt.timedelta(seconds=15)
server = "smtp.gmail.com"
user = 'i89831323121@gmail.com'
password = 'knwtdsawwnlfnrhi'
recipients = ['glazok.onlaine@gmail.com']# Можно добваить второго пользователя через запятую
sender = 'i89831323121@gmail.com'
subject = 'У вас новый посетитель!'
text = ''
html = ''
while True:

	_, image = cap.read()

	height, width = image.shape[0], image.shape[1]
	blob = cv2.dnn.blobFromImage(cv2.resize(image, (300, 300)), 0.007, (300, 300), 130)

	net.setInput(blob)
	detected_objects = net.forward()

	for i in range(detected_objects.shape[2]):

		confidence = detected_objects[0][0][i][2]

		if confidence > min_confidence:

			class_index = int(detected_objects[0, 0, i, 1])

			upper_left_x = int(detected_objects[0, 0, i, 3] * width)
			upper_left_y = int(detected_objects[0, 0, i, 4] * height)
			lower_right_x = int(detected_objects[0, 0, i, 5] * width)
			lower_right_y = int(detected_objects[0, 0, i, 6] * height)

			prediction_text = f"{classes[class_index]}: {confidence:.2f}%"
			cv2.rectangle(image, (upper_left_x, upper_left_y), (lower_right_x, lower_right_y), colors[class_index], 3)
			cv2.putText(image, prediction_text, (upper_left_x,
												 upper_left_y - 15 if upper_left_y > 30 else upper_left_y + 15),
						cv2.FONT_HERSHEY_SIMPLEX, 0.6, colors[class_index], 2)

			if class_index == 15:
				if pip == 1:
					cv2.imwrite(f'{pip}.png', image)
					filepath = f"{pip}.png"
					basename = os.path.basename(filepath)
					filesize = os.path.getsize(filepath)

					msg = MIMEMultipart('alternative')
					msg['Subject'] = subject
					msg['From'] = 'GlazokOnline <' + sender + '>'
					msg['To'] = ', '.join(recipients)
					msg['Reply-To'] = sender
					msg['Return-Path'] = sender
					msg['X-Mailer'] = 'Python/' + (python_version())

					part_text = MIMEText(text, 'plain')
					part_html = MIMEText(html, 'html')
					part_file = MIMEBase('application', 'octet-stream; name="{}"'.format(basename))
					part_file.set_payload(open(filepath, "rb").read())
					part_file.add_header('Content-Description', basename)
					part_file.add_header('Content-Disposition', 'attachment; filename="{}"; size={}'.format(basename, filesize))
					encoders.encode_base64(part_file)

					msg.attach(part_text)
					msg.attach(part_html)
					msg.attach(part_file)

					mail = smtplib.SMTP_SSL(server)
					mail.login(user, password)
					mail.sendmail(sender, recipients, msg.as_string())
					mail.quit()
					print(f"Файл {pip} сохранен и отправлен")
					time_15 = dt.datetime.now()+dt.timedelta(seconds=5)
					pip += 1
				if pip >= 2:
					if dt.datetime.now() >= time_15:
						cv2.imwrite(f'{pip}.png', image)
						filepath = f"{pip}.png"
						basename = os.path.basename(filepath)
						filesize = os.path.getsize(filepath)

						msg = MIMEMultipart('alternative')
						msg['Subject'] = subject
						msg['From'] = 'GlazokOnline <' + sender + '>'
						msg['To'] = ', '.join(recipients)
						msg['Reply-To'] = sender
						msg['Return-Path'] = sender
						msg['X-Mailer'] = 'Python/' + (python_version())

						part_text = MIMEText(text, 'plain')
						part_html = MIMEText(html, 'html')
						part_file = MIMEBase('application', 'octet-stream; name="{}"'.format(basename))
						part_file.set_payload(open(filepath, "rb").read())
						part_file.add_header('Content-Description', basename)
						part_file.add_header('Content-Disposition', 'attachment; filename="{}"; size={}'.format(basename, filesize))
						encoders.encode_base64(part_file)

						msg.attach(part_text)
						msg.attach(part_html)
						msg.attach(part_file)

						mail = smtplib.SMTP_SSL(server)
						mail.login(user, password)
						mail.sendmail(sender, recipients, msg.as_string())
						mail.quit()
						time_15 = dt.datetime.now()+dt.timedelta(seconds=5)
						print(f"Файл {pip} сохранен и отправлен")
						pip += 1
					else:
						continue
				else:
					continue
			else:
				continue








	cv2.imshow("Web-Kamera", image)
	cv2.waitKey(5)



cv2.destroyAllWindows()
cap.release()
  • Вопрос задан
  • 154 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы