PHP Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/ftp/u/umxopinm/wwwroot/wp-includes/wp-db.php on line 2033 WordPress数据库查询SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (815) ORDER BY t.name ASC 时发生Got error 28 from storage engine错误,这是由require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/shapely/page-templates/full-width.php'), get_header, locate_template, load_template, require_once('/themes/shapely/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, adjacent_posts_rel_link_wp_head, adjacent_posts_rel_link, get_adjacent_post_rel_link, get_permalink, get_the_category, get_the_terms, wp_get_object_terms, get_terms, WP_Term_Query->query, WP_Term_Query->get_terms查询的 PHP Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/ftp/u/umxopinm/wwwroot/wp-includes/wp-db.php on line 2033 WordPress数据库查询SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (825) ORDER BY t.name ASC 时发生Got error 28 from storage engine错误,这是由require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/shapely/page-templates/full-width.php'), get_header, locate_template, load_template, require_once('/themes/shapely/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, adjacent_posts_rel_link_wp_head, adjacent_posts_rel_link, get_adjacent_post_rel_link, get_permalink, get_the_category, get_the_terms, wp_get_object_terms, get_terms, WP_Term_Query->query, WP_Term_Query->get_terms查询的

Codes

Codes

Save 68 landmarks to TXT

Python Codes:

import cv2
import dlib
import numpy as np
import imutils
import os

def get_points(img_path):
    img = cv2.imread(img_path)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    detector = dlib.get_frontal_face_detector()
    detector_path = "D:/Anaconda3/Anaconda/Lib/site-packages/dlib/shape_predictor_68_face_landmarks.dat"
    predictor = dlib.shape_predictor(detector_path)
    dets = detector(gray, 1)
    pts = []
    for face in dets:
        shape = predictor(img, face)  # 68 landmarks on human face
        for pt in shape.parts():
            pt_pos = (pt.x, pt.y)
            pts.append(pt_pos)
    return pts

def write_txt(points_list, txt_path, count):
    with open(txt_path + "/" + "keypoints.txt", "a") as f:
        f.write("#" + str(count) + "\n")
        for points_tuple in points_list:
            f.write(str(points_tuple[0])+"," + str(points_tuple[1]) + "\n")

def main():
    path = "C:/Users/lenovo/Desktop/euromale"
    os.chdir(path)
    files = os.listdir(".")
    count = 1
    while count <= len(files):
        img_path = path + "/" + str(count) + ".jpg"
        write_txt(get_points(img_path), path, count)
        count = count + 1

if __name__ == "__main__":
    main()

Save Eyebrows / Eyes Landmarks to TXT

Python Codes:

import cv2
import dlib
import os

def get_points(img_path):
    img = cv2.imread(img_path)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    detector = dlib.get_frontal_face_detector()
    detector_path = "D:/Anaconda3/Anaconda/Lib/site-packages/dlib/shape_predictor_68_face_landmarks.dat"
    predictor = dlib.shape_predictor(detector_path)
    dets = detector(gray, 1)
    pts = []
    for face in dets:
        shape = predictor(img, face)  # 68 landmarks on human face
        for pt in shape.parts():
            pt_pos = (pt.x, pt.y)
            pts.append(pt_pos)
    return pts

def write_txt(points_list, txt_path, count):
    with open(txt_path + "/" + "keypoints_eyes-eyebrow.txt", "a") as f:
        f.write("#" + str(count) + "\n")
        f.write("left eyebrow (17-21): " + "\n")
        for points_tuple in points_list[17:22]:
            f.write(str(points_tuple[0])+"," + str(points_tuple[1]) + "\n")
        f.write("right eyebrow (22-26): " + "\n")
        for points_tuple in points_list[22:27]:
            f.write(str(points_tuple[0])+"," + str(points_tuple[1]) + "\n")
        f.write("left eye (36-41): " + "\n")
        for points_tuple in points_list[36:42]:
            f.write(str(points_tuple[0])+"," + str(points_tuple[1]) + "\n")
        f.write("right eye (42-47): " + "\n")
        for points_tuple in points_list[42:48]:
            f.write(str(points_tuple[0])+"," + str(points_tuple[1]) + "\n")  

def main():
    path = "C:/Users/lenovo/Desktop/euromale"
    os.chdir(path)
    files = os.listdir(".")
    count = 1
    while count <= len(files):
        img_path = path + "/" + str(count) + ".jpg"
        write_txt(get_points(img_path), path, count)
        count = count + 1

if __name__ == "__main__":
    main()

Save Eyebrows – Eyes Ratio to TXT

Python Codes:

import linecache

def get_line_content(txt_path, line_num):
    return linecache.getline(txt_path, line_num + 1).strip()

def get_eye_length(count, txt_path, position):
    with open(txt_path, "r") as f:
        point_left = get_line_content(txt_path, 27*(count-1)+position)
        point_right = get_line_content(txt_path, 27*(count-1)+position+3)
        point_left_x, point_left_y = int(point_left.split(",")[0]), int(point_left.split(",")[1])
        point_right_x, point_right_y = int(point_right.split(",")[0]), int(point_right.split(",")[1])
    return ((point_left_x-point_right_x)**2 + (point_left_y-point_right_y)**2)**0.5

def get_eyebrow_length(count, txt_path, position):
    with open(txt_path, "r") as f:
        point_left = get_line_content(txt_path, 27*(count-1)+position)
        point_right = get_line_content(txt_path, 27*(count-1)+position+4)
        point_left_x, point_left_y = int(point_left.split(",")[0]), int(point_left.split(",")[1])
        point_right_x, point_right_y = int(point_right.split(",")[0]), int(point_right.split(",")[1])
    return ((point_left_x-point_right_x)**2 + (point_left_y-point_right_y)**2)**0.5

# left eye position: 14; right eye position: 21; 
# left eyebrow position: 2; right eyebrow position: 8 

def write_txt(count, txt_path):
    with open("C:/Users/lenovo/Desktop/" + "eye-eyebrow ratio.txt", "a") as f:
        f.write(get_line_content(txt_path, 27*(count-1)) + "\n")
        f.write("left ratio\n")
        f.write(str(get_eyebrow_length(count, txt_path, 2)/get_eye_length(count, txt_path, 14)) + "\n")
        f.write("right ratio\n")
        f.write(str(get_eyebrow_length(count, txt_path, 8)/get_eye_length(count, txt_path, 21)) + "\n")

def main():
    txt_path = "C:/Users/lenovo/Desktop/keypoints_eyes-eyebrow.txt"
    count = 1
    file_length = len(open(txt_path).readlines())
    while count <= file_length/27:
        write_txt(count, txt_path)
        count = count + 1

if __name__ == "__main__":
    main()
PHP Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/ftp/u/umxopinm/wwwroot/wp-includes/wp-db.php on line 2033 WordPress数据库查询SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (801, 805, 812) ORDER BY t.name ASC 时发生Got error 28 from storage engine错误,这是由require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/shapely/page-templates/full-width.php'), get_template_part, locate_template, load_template, require('/themes/shapely/template-parts/content.php'), do_action('shapely_single_after_article'), WP_Hook->do_action, WP_Hook->apply_filters, Shapely_Related_Posts->output_related_posts, Shapely_Related_Posts->get_related_posts, WP_Query->__construct, WP_Query->query, WP_Query->get_posts, _prime_post_caches, update_post_caches, update_object_term_cache, wp_get_object_terms, get_terms, WP_Term_Query->query, WP_Term_Query->get_terms查询的 PHP Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/ftp/u/umxopinm/wwwroot/wp-includes/wp-db.php on line 2033 WordPress数据库查询SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (825, 815) ORDER BY t.name ASC 时发生Got error 28 from storage engine错误,这是由require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/shapely/page-templates/full-width.php'), get_template_part, locate_template, load_template, require('/themes/shapely/template-parts/content.php'), do_action('shapely_single_after_article'), WP_Hook->do_action, WP_Hook->apply_filters, Shapely_Related_Posts->output_related_posts, Shapely_Related_Posts->get_related_posts, WP_Query->__construct, WP_Query->query, WP_Query->get_posts, update_post_caches, update_object_term_cache, wp_get_object_terms, get_terms, WP_Term_Query->query, WP_Term_Query->get_terms查询的
Kathleen Li

发表评论

电子邮件地址不会被公开。 必填项已用*标注