Python深度学习实战 基于tensorflow和keras的聊天机器人以及人脸、物体和语音识别


Python深度学习实战 基于tensorflow和keras的聊天机器人以及人脸、物体和语音识别
资源截图
代码片段和文件信息
# Import the OpenCV library
import cv2
# Initialize a face cascade using the frontal face haar cascade provided
# with the OpenCV2 library. This will be required for face detection in an
# image.
faceCascade = cv2.CascadeClassifier(‘haarcascade_frontalface_default.xml‘)
# The desired output width and height can be modified according to the needs.
OUTPUT_SIZE_WIDTH = 700
OUTPUT_SIZE_HEIGHT = 600

# Open the first webcam device
capture = cv2.VideoCapture(0)

# Create two opencv named windows for showing the input output images.
cv2.namedWindow(“base-image“ cv2.WINDOW_AUTOSIZE)
cv2.namedWindow(“result-image“ cv2.WINDOW_AUTOSIZE)

# Position the windows next to each other
cv2.moveWindow(“base-image“ 20 200)
cv2.moveWindow(“result-image“ 640 200)

# Start the window thread for the two windows we are using
cv2.startWindowThread()

rectangleColor = (0 100 255)

while(1):
    # Retrieve the latest image from the webcam
    rcfullSizebaseImage = capture.read()
# Resize the image to 520x420
    baseImage= cv2.resize(fullSizebaseImage (520 420))

# Check if a key was pressed and if it was Q or q then destroy all
# opencv windows and exit the application stopping the infinite loop.
    pressedKey = cv2.waitKey(2)
    if (pressedKey == ord(‘Q‘)) | (pressedKey == ord(‘q‘)):
        cv2.destroyAllWindows()
        exit(0)
# Result image is the image we will show the user which is a
# combination of the original image captured from the webcam with the
# overlayed rectangle detecting the largest face
    resultImage = baseImage.copy()

# We will be using gray colored image for face detection.
# So we need to convert the baseImage captured by webcam to a gray-based image
    gray_image = cv2.cvtColor(baseImage cv2.COLOR_BGR2GRAY)
    faces = faceCascade.detectMultiScale(gray_image 1.3 5)
    # As we are only interested in the ‘largest‘ face we need to
# calculate the largest area of the found rectangle.
# For this first initialize the required variables to 0.
    maxArea = 0
    x = 0
    y = 0
    w = 0
    h = 0

# Loop over all faces found in the image and check if the area for this face is
# the largest so far
    for(_x _y _w _h) in faces:
        if _w * _h > maxArea:
            x = _x
            y = _y
            w = _w
            h = _h
            maxArea = w * h
# If any face is found draw a rectangle around the largest face present in the picture
    if maxArea > 0:
        cv2.rectangle(resultImage (x-10 y-20)(x + w+10 y + h+20) rectangleColor 2)
# Since we want to show something larger on the screen than the
# original 520x420 we resize the image again

# Note that it would also be possible to keep the large version
# of the baseimage and make the result image a copy of this large
# base image and use the scaling factor to draw the rectangle
# at the right coordinates.
    largeResult = cv2.resize(resultImage(OUTPUT_SIZE_WIDTH OUTPUT_SIZE_HEIGHT))
# Finally we show the images on the screen
    cv2.imshow(“base-im

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-master
     文件          66  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-master.gitattributes
     文件       28610  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-master9781484235157.jpg
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter10_RNN and LSTM in visual
     文件       58177  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter10_RNN and LSTM in visualTime Series forcasting with lstm model.ipynb
     文件       48119  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter10_RNN and LSTM in visualsp500.csv
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter11_Speech to text and vice versa
     文件       14096  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter11_Speech to text and vice versaSpeech to Text API and Text to Speech.ipynb
     文件      704556  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter11_Speech to text and vice versaaudio.wav
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter12_Developing Chatbots
     文件          72  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter12_Developing ChatbotsRemoving Punctuations.ipynb
     文件          72  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter12_Developing ChatbotsRemoving Stopwords.ipynb
     文件       26152  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter12_Developing ChatbotsTF-IDF and Word2Vec.ipynb
     文件          72  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter12_Developing ChatbotsTokenization.ipynb
     文件        1393  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter12_Developing Chatbotsintent1.csv
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter13_Face Recognition
     文件        3062  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter13_Face RecognitionFace_Detection.py
     文件        5288  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter13_Face RecognitionFace_Recognition.py
     文件        6612  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter13_Face RecognitionFace_Tracking.py
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter1_Prerequisites of  Deep Learning Numpy Pandas and Scikit-Learn
     文件      341456  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter1_Prerequisites of  Deep Learning Numpy Pandas and Scikit-Learnchapter1_summary.ipynb
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter2_Basics of Tensorflow
     文件        6190  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter2_Basics of TensorflowTFBasics.ipynb
     文件       27538  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter2_Basics of Tensorflowchapter2_summary.ipynb
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter3_Understanding and working on Keras
     文件       32446  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter3_Understanding and working on KerasMLPMNIST.ipynb
     文件        9107  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter3_Understanding and working on KerasSoftmax _RegressionB.ipynb
     文件       34522  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter3_Understanding and working on Keraschapter3_summary.ipynb
     文件    13115488  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter3_Understanding and working on Kerasmodel.h5
     文件     6564312  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter3_Understanding and working on KerasmodelWeight.h5
     目录           0  2018-05-22 15:41  Deep-Learning-Apps-Using-Python-masterChapter5_Regresson to MLP in Tensorflow
............此处省略27个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)