반응형
250x250
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- aws cicd
- Jenkins
- bootstrap
- chartjs
- java bigdecimal
- AWS CI/CD 구축하기
- codebuild
- codedeploy
- Flux
- aws
- Spring
- or some instances in your deployment group are experiencing problems.
- Spring Error
- VPN
- JavaScript
- codedeploy error
- codepipeline
- SQL
- PostgreSQL
- node
- Python
- Airflow
- Kafka
- redis
- 도커
- chart.js
- COALESCE
- docker
- IntelliJ
- kubeflow
Archives
- Today
- Total
Small Asteroid Blog
[python] 얼굴검출되는 이미지와 검출되지 않는 이미지 분류해서 폴더별로 저장시키기 본문
728x90
여러 이미지중에
얼굴검출되는 이미지와 검출되지 않는 이미지 분류해서 폴더별로 저장시키기
import face_recognition
from matplotlib import pyplot as plt
import cv2
from PIL import Image
import os
import shutil
#확인 할 이미지가 들어있는 폴더
imagepath = 'D:/my/video frame/cropface/'
#인식 안되는 얼굴들 이동할 폴더 경로
mvpath = 'D:/my/video frame/noface2/'
for root, dirs, files in os.walk(imagepath):
#print('root > ',root, 'dirs >',dirs,'files >', files)
for idx, file in enumerate(files):
#print("index : {}, value: {}".format(idx,file))
#print('idx > ',idx,' file > ', file)
imgfile = imagepath+file
face_locations = 0
image = face_recognition.load_image_file(imgfile) #, mode='RGB'
face_locations = face_recognition.face_locations(image)
#print("I found {} face(s) in this photograph.".format(len(face_locations)))
if len(face_locations) == 0:
print(idx,'>> ',imagepath+file)
shutil.move(imagepath+file, mvpath+file)
#print(imagepath+file)
else:
print(idx,'>> ',len(face_locations))
print('finish')
728x90
반응형
'백엔드 > Python' 카테고리의 다른 글
인터프리터언어란, 컴파일언어란 (0) | 2021.03.30 |
---|---|
[error] string index out of range (0) | 2021.03.30 |
python CascadeClassifier를 이용한 얼굴영역 표시 (0) | 2021.01.12 |
python face_recognition 로 얼굴영역만 자르기 (0) | 2021.01.12 |
[python] error: (-215) !empty() in function detectMultiScale (0) | 2020.12.04 |