程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Raspberry PI and python opencv tensorflow convolution neural network thermal imaging person detection

編輯:Python

Build logic , Regularly capture snapshots from infrared cameras , Standardize it , And store it somewhere . Mark the picture ( Character detected / It is detected that the character does not exist ) And train the model on it . Deploy the model on the raspberry pie and run regular detection against the newly captured images , Whether the people in the room exist .

Bill of material

Communication selection

System preparation

Capture images

Now we have all the hardware and software ready , Let's configure to periodically capture camera images and store them locally - We will use these images to train our model later .

It is basically a process that can execute and run some custom operations on a regular basis . Let us in config.yaml Add a cron, It takes pictures from the sensor and stores them in a local directory . First , Create... On raspberry pie images Catalog :

And then in config.yaml Add cron The logic of :

cron.ThermalCameraSnapshotCron:
cron_expression: '* * * * *'
actions:
- action: camera.ir.mlx90640.capture_image
args:
image_file: ~/datasets/people_detect/\
${
int(__import__('time').time())}.jpg
grayscale: true

Tag image

Once you capture enough images , You can copy them to your computer , Mark them and train the model . What is waiting for us now is the boring part —— Manually mark images as positive or negative . I used a script to make this task less tedious , This script allows you to interactively mark images while viewing them , And move them to the correct target directory . Install the dependencies on the local machine and clone the repository :

Training models

from tensorflow.keras.preprocessing.image import
ImageDataGenerator
# 30% of the images goes into the test set
generator = ImageDataGenerator(rescale=1./255, validation_
split=0.3)
train_data = generator.flow_from_directory(dataset_dir,
target_size=image_size,
batch_size=batch_size,
subset='training',
class_mode='categorical',
color_mode='grayscale')
test_data = generator.flow_from_directory(dataset_dir,
target_size=image_size,
batch_size=batch_size,
subset='validation',

Execution model

Establish automated processes

Use the above model to build security monitoring

Source code

Deployment model

Refer to the - Yatu inter


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved