Recording of code for clinical studies rejected by the Ethics Committee

The code below was created for clinical research in the anesthesiology department. The theme was "preoperative airway evaluation by face recognition (provisional)". The project itself was rejected by the Ethics Committee. Similar clinical research is underway at another institution, but it has nothing to do with us.

The purpose is to recognize the front image of the face, create a temporary coordinate point, and acquire the face part data from it. Regarding usage intention General anesthesia requires tracheal intubation that leads to artificial respiration, but the difficulty varies from patient to patient. When inserting an airway tube after sleeping under anesthesia, the number cormack is used to classify how much the airway is actually visible. Using this as output data, I created it with the idea that it would be useful for preoperative examinations by investigating the correlation with facial part data and performing machine learning.

#
import cv2
import pandas as pd
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import dlib
detector = dlib.get_frontal_face_detector()
predictor =
dlib.shape_predictor('filepath/shape_predictor_68_face_landmarks.dat')
frame = cv2.imread('filepathofimage.jpg')
dets = detector(frame[:, :, ::-1])
print(predictor)

dets=detector(frame[:,:,::-1])
if len(dets)>0:
    parts=predictor(frame,dets[0]).parts()

#Verification
img = frame*0
for i in parts:
    cv2.circle(img,(i.x,i.y),3,(255,0,0),-1)

#Since cv2imshow is impossible, plt
plt.imshow(img)
dets=detector(frame[:,:,::-1])

if len(dets)>0:
    parts=predictor(frame,dets[0]).parts()

#For confirmation
img = frame*0
for i in parts:
    cv2.circle(img,(i.x,i.y),3,(255,0,0),-1)

print(parts)
pd.DataFrame(data=parts)

Finally it is stored in the data frame.

There are many hp that I referred to, and it is a composite custom product. Thank you to our ancestors. It wasn't a copyrighted hp, but if you have any problems please point it out.

Recommended Posts

Recording of code for clinical studies rejected by the Ethics Committee
Pandas of the beginner, by the beginner, for the beginner [Python]
Code for checking the operation of Python Matplotlib
Explain the code of Tensorflow_in_ROS
Check the memory protection of linux kerne with the code for ARM
Example of code rewriting by ast.NodeTransformer
About Python code for simple moving average assuming the use of Numba
Python learning memo for machine learning by Chainer until the end of Chapter 2