TW202303451A - Nail recognation methods, apparatuses, devices and storage media - Google Patents

Nail recognation methods, apparatuses, devices and storage media Download PDF

Info

Publication number
TW202303451A
TW202303451A TW110148657A TW110148657A TW202303451A TW 202303451 A TW202303451 A TW 202303451A TW 110148657 A TW110148657 A TW 110148657A TW 110148657 A TW110148657 A TW 110148657A TW 202303451 A TW202303451 A TW 202303451A
Authority
TW
Taiwan
Prior art keywords
nail
image
key point
detection
frame
Prior art date
Application number
TW110148657A
Other languages
Chinese (zh)
Inventor
劉昕
謝符寶
劉文韜
Original Assignee
大陸商北京市商湯科技開發有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商北京市商湯科技開發有限公司 filed Critical 大陸商北京市商湯科技開發有限公司
Publication of TW202303451A publication Critical patent/TW202303451A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Computational Linguistics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)
  • Measurement Of The Respiration, Hearing Ability, Form, And Blood Characteristics Of Living Organisms (AREA)
  • Image Processing (AREA)

Abstract

Nail recognition methods, apparatuses, devices and storage media are disclosed. The method comprises: obtaining a detection result of at least one nail in a first image, where the detection result comprises a first nail detection frame and a classification result of the nail, where the classification result indicates a finger type to which the nail belongs; obtaining an image area corresponding to the nail in the first image according to the first nail detection frame; obtaining a plurality of first key points of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs.

Description

指甲識別方法、裝置、設備及儲存媒體Nail recognition method, device, equipment and storage medium

本申請涉及影像識別技術領域,尤其涉及一種指甲識別方法、裝置、設備及儲存媒體。The present application relates to the technical field of image recognition, and in particular to a nail recognition method, device, equipment and storage medium.

指甲識別在移動互娛、虛擬試裝、虛擬實境VR、擴增實境AR等領域具有重要的應用前景。相關技術中,通常利用分割模型(segmentation)得到影像或視頻中的指甲區域,然而這種方法並不能得到指甲輪廓的語意資訊,使得識別結果在各個應用場景中的使用受到了限制。Nail recognition has important application prospects in mobile entertainment, virtual fitting, virtual reality VR, augmented reality AR and other fields. In related technologies, the segmentation model (segmentation) is usually used to obtain the nail region in the image or video. However, this method cannot obtain the semantic information of the nail outline, which limits the use of the recognition results in various application scenarios.

本公開實施例提供一種指甲識別方案。An embodiment of the present disclosure provides a nail recognition solution.

根據本公開的一方面,提供一種指甲識別方法,所述方法包括:獲取第一影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域;根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。According to an aspect of the present disclosure, a nail recognition method is provided, the method comprising: acquiring a detection result of at least one nail in a first image, the detection result including a first nail detection frame and a classification result of the nail, the The classification result indicates the finger type to which the nail belongs; the image area corresponding to the nail in the first image is obtained according to the first nail detection frame; the image area corresponding to the nail is obtained according to the finger type to which the nail belongs Multiple first keypoints for the nails described in .

通過獲取指甲的分類結果,並根據指甲所屬手指類型獲得相應的指甲對應的第一關鍵點,可以獲得指甲的類別資訊和指甲輪廓的完整語意特徵,便於指甲識別結果在各個場景下的應用。By obtaining the classification results of nails and obtaining the first key point corresponding to the corresponding nails according to the type of finger to which the nails belong, the category information of the nails and the complete semantic features of the nail outline can be obtained, which facilitates the application of the nail recognition results in various scenarios.

結合本公開提供的任一實施方式,所述根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中,所述指甲的多個第一關鍵點,包括:從所述第一影像中裁剪出所述指甲對應的影像區域;將裁剪出的影像區域輸入至所述指甲所屬手指類型對應的第一關鍵點檢測網路中,得到所述指甲的多個第一關鍵點。In combination with any of the implementations provided in the present disclosure, the obtaining multiple first key points of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs includes: from the first image Cut out the image area corresponding to the nail; input the cropped image area into the first key point detection network corresponding to the finger type to which the nail belongs to obtain multiple first key points of the nail.

通過裁剪出所述指甲對應的影像區域,並根據裁剪出的影像進行指甲關鍵點檢測,可以提高指甲關鍵點檢測的效率和準確度。By cutting out the image area corresponding to the nail, and performing nail key point detection according to the clipped image, the efficiency and accuracy of nail key point detection can be improved.

結合本公開提供的任一實施方式,所述方法還包括:獲取所述指甲對應的影像區域中各個像素的二分類結果,所述二分類結果指示所述像素為前景像素或背景像素;將所述二分類結果中指示為背景像素的像素設置為第一像素值。In combination with any embodiment provided in the present disclosure, the method further includes: acquiring a binary classification result of each pixel in the image region corresponding to the nail, the binary classification result indicating that the pixel is a foreground pixel or a background pixel; A pixel indicated as a background pixel in the above binary classification result is set as the first pixel value.

通過對所述指甲對應的影像區域中,或者裁剪出的影像中的背景像素進行濾除操作,只保留真實指甲對應的區域,可以減小指甲關鍵點誤檢的機率。By performing a filtering operation on background pixels in the image area corresponding to the nail or in the cropped image, only the area corresponding to the real nail is retained, which can reduce the probability of false detection of nail key points.

結合本公開提供的任一實施方式,所述方法還包括:依據所述指甲的多個第一關鍵點中的至少兩個第一關鍵點在所述影像區域中的位置資訊,確定所述指甲的方向。In combination with any of the implementations provided in the present disclosure, the method further includes: according to the position information of at least two first key points of the plurality of first key points of the nail in the image area, determining the direction.

通過獲取所述指甲的方向,便於指甲識別結果在各個場景下的應用,例如在為影像中指甲添加美甲特效的場景中,在獲知指甲的方向的情況下,可以更方便地為指甲添加美甲特效。By obtaining the direction of the nail, it is convenient to apply the nail recognition result in various scenarios. For example, in the scene of adding nail art effects to the nails in the image, it is more convenient to add nail art effects to the nails when the direction of the nails is known. .

結合本公開提供的任一實施方式,所述方法還包括:獲取樣本影像;其中,所述樣本影像具有標註資訊,所述標註資訊指示與所述樣本影像所屬手指類型對應的第一關鍵點;將所述樣本影像輸入至所述第一關鍵點檢測網路,得到關鍵點檢測結果;根據所述關鍵點檢測結果與所述標註資訊之間的差異,對所述第一關鍵點檢測網路的網路參數進行調整。In combination with any implementation manner provided by the present disclosure, the method further includes: acquiring a sample image; wherein, the sample image has annotation information, and the annotation information indicates a first key point corresponding to the finger type to which the sample image belongs; inputting the sample image into the first key point detection network to obtain a key point detection result; according to the difference between the key point detection result and the annotation information, the first key point detection network Adjust the network parameters.

通過根據樣本影像中指甲所述手指類型對指甲進行資訊標註,並利用所述樣本影像對第一關鍵點檢測網路進行訓練,可以實現第一關鍵點檢測網路針對指定手指類型的指甲的識別。By annotating the nail information according to the finger type of the nail in the sample image, and using the sample image to train the first key point detection network, the first key point detection network can realize the recognition of the nail of the specified finger type .

結合本公開提供的任一實施方式,所述第一影像是影像序列中的一幀,所述方法還包括:對於所述第一影像之後的第二影像,根據所述第二影像的前一幀中所述指甲的多個第一關鍵點,確定第二影像中的第二指甲檢測框;獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點。In combination with any implementation manner provided by the present disclosure, the first image is a frame in an image sequence, and the method further includes: for a second image following the first image, according to a previous frame of the second image A plurality of first key points of the nail in the frame, determine a second nail detection frame in the second image; obtain, in the image area corresponding to the second nail detection frame in the second image, the nail's Multiple second keys.

通過根據影像序列中前一幀的關鍵點檢測結果,得到當前幀中的關鍵點檢測結果,可以減小數據處理量,提高指甲關鍵點檢測的速度和效率。By obtaining the key point detection result in the current frame according to the key point detection result of the previous frame in the image sequence, the amount of data processing can be reduced, and the speed and efficiency of nail key point detection can be improved.

結合本公開提供的任一實施方式,所述根據所述第二影像的前一幀中的多個第一關鍵點,確定第二影像中的第二指甲檢測框,包括:根據所述前一幀中的所述指甲的多個第一關鍵點,得到所述指甲的外接矩形框;根據所述外接矩形框在所述前一幀中的位置資訊,將所述外接矩形框映射至所述第二影像中,作為所述第二影像中的第二指甲檢測框。In combination with any implementation manner provided by the present disclosure, the determining the second nail detection frame in the second image according to the multiple first key points in the previous frame of the second image includes: according to the previous frame A plurality of first key points of the nail in the frame to obtain a circumscribing rectangle of the nail; according to the position information of the circumscribing rectangle in the previous frame, map the circumscribing rectangle to the In the second image, as the second nail detection frame in the second image.

通過上述方法得到的第二影像中的第二指甲檢測框,相較於通過指甲檢測到的第一指甲檢測框,更接近指甲的真實區域,且包含更少指甲以外的部分,有利於提高關鍵點檢測的精度。Compared with the first nail detection frame detected by the nail, the second nail detection frame in the second image obtained by the above method is closer to the real area of the nail and contains less parts other than the nail, which is beneficial to improve the key Accuracy of point detection.

結合本公開提供的任一實施方式,所述獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點,包括:裁剪出所述第二影像中所述第二指甲檢測框對應的影像區域;將裁剪出的影像區域輸入至第二關鍵點檢測網路,得到所述指甲的第二關鍵點。In combination with any implementation manner provided by the present disclosure, the obtaining multiple second key points of the nail in the image area corresponding to the second nail detection frame in the second image includes: cutting out the The image area corresponding to the second nail detection frame in the second image; input the cropped image area to the second key point detection network to obtain the second key point of the nail.

第二關鍵點檢測網路可以基於回歸關鍵點進行指甲關鍵點檢測,相較於基於熱度圖進行指甲關鍵點檢測的第一關鍵點檢測網路,網路結構更簡單、層數較小、處理速度更快,減少了進行指甲關鍵點檢測的耗時。The second key point detection network can detect nail key points based on regression key points. Compared with the first key point detection network based on heat map for nail key point detection, the network structure is simpler, the number of layers is smaller, and the processing The speed is faster and the time-consuming for nail key point detection is reduced.

結合本公開提供的任一實施方式,在將所述裁剪出的影像區域輸入至第二關鍵點檢測網路之前,根據所述前一幀中所述指甲的方向,對所述裁剪出的影像進行旋轉處理。In combination with any of the implementations provided by the present disclosure, before inputting the cropped image region into the second key point detection network, according to the direction of the nail in the previous frame, the cropped image is Perform rotation.

對旋轉後的影像進行指甲關鍵點檢測,一方面可以提高檢測的效率,一方面也可以提高檢測的精度。The nail key point detection on the rotated image can improve the efficiency of detection on the one hand and the accuracy of detection on the other hand.

結合本公開提供的任一實施方式,所述方法還包括:在未檢測到所述指甲的第二關鍵點或所述指甲的第二關鍵點不符合設定要求的情況下,獲取第二影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;根據所述第一指甲檢測框得到所述第二影像中所述指甲對應的影像區域;根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。In combination with any implementation manner provided by the present disclosure, the method further includes: when the second key point of the nail is not detected or the second key point of the nail does not meet the set requirements, acquiring the second key point in the second image A detection result of at least one nail, the detection result comprising a first nail detection frame and a classification result of the nail, the classification result indicating the finger type to which the nail belongs; the second nail detection frame is obtained according to the first nail detection frame An image area corresponding to the nail in the image; according to the finger type to which the nail belongs, a plurality of first key points of the nail in the image area corresponding to the nail are obtained.

通過對追蹤得到的指甲的第二關鍵點進行判定,在未檢測到或者不符合設定要求的情況下,則重新進行指甲識別,一方面保證了指甲識別結果的連貫性,另一方面也保證了指甲識別結果的準確性。By judging the second key point of the nail tracked, if it is not detected or does not meet the set requirements, the nail recognition will be performed again. On the one hand, it ensures the consistency of the nail recognition results, and on the other hand, it also ensures Accuracy of nail recognition results.

根據本公開的一方面,提供一種指甲識別裝置,包括:第一獲取單元,用於獲取第一影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;第二獲取單元,用於根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域;識別單元,用於根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。According to an aspect of the present disclosure, there is provided a nail recognition device, including: a first acquiring unit, configured to acquire a detection result of at least one nail in a first image, the detection result including a first nail detection frame and a classification of the nail As a result, the classification result indicates the finger type to which the nail belongs; the second acquisition unit is configured to obtain the image area corresponding to the nail in the first image according to the first nail detection frame; The finger type to which the nail belongs, and a plurality of first key points of the nail in the image area corresponding to the nail are obtained.

結合本公開提供的任一實施方式,所述識別單元具體用於:從所述第一影像中裁剪出所述指甲對應的影像區域;將裁剪出的影像區域輸入至所述指甲所屬手指類型對應的第一關鍵點檢測網路中,得到所述指甲的多個第一關鍵點。In combination with any of the implementations provided in the present disclosure, the identification unit is specifically configured to: crop out the image area corresponding to the nail from the first image; input the cropped image area into the In the first key point detection network, multiple first key points of the nail are obtained.

結合本公開提供的任一實施方式,所述裝置還包括過濾單元,用於:獲取所述指甲對應的影像區域中各個像素的二分類結果,所述二分類結果指示所述像素為前景像素或背景像素;將所述二分類結果中指示為背景像素的像素設置為第一像素值。In combination with any embodiment provided in the present disclosure, the device further includes a filtering unit, configured to: obtain a binary classification result of each pixel in the image region corresponding to the nail, the binary classification result indicating that the pixel is a foreground pixel or Background pixels: setting the pixels indicated as background pixels in the binary classification result as the first pixel value.

結合本公開提供的任一實施方式,所述裝置還包括定向單元,用於:依據所述指甲的多個第一關鍵點中的至少兩個第一關鍵點在所述影像區域中的位置資訊,確定所述指甲的方向。In combination with any implementation manner provided by the present disclosure, the device further includes an orientation unit configured to: according to the position information of at least two first key points among the plurality of first key points of the nail in the image area , to determine the orientation of the nail.

結合本公開提供的任一實施方式,所述裝置還包括訓練單元,用於:獲取樣本影像;其中,所述樣本影像具有標註資訊,所述標註資訊指示與所述樣本影像所屬手指類型對應的第一關鍵點;將所述樣本影像輸入至所述第一關鍵點檢測網路,得到關鍵點檢測結果;根據所述關鍵點檢測結果與所述標註資訊之間的差異,對所述第一關鍵點檢測網路的網路參數進行調整。In combination with any of the implementations provided in the present disclosure, the device further includes a training unit configured to: acquire a sample image; wherein, the sample image has annotation information, and the annotation information indicates the finger type corresponding to the sample image. The first key point; input the sample image to the first key point detection network to obtain a key point detection result; according to the difference between the key point detection result and the annotation information, the first key point detection The network parameters of the keypoint detection network are tuned.

結合本公開提供的任一實施方式,所述第一影像是影像序列中的一幀,所述裝置還包括追蹤單元,用於:對於所述第一影像之後的第二影像,根據所述第二影像的前一幀中所述指甲的多個第一關鍵點,確定第二影像中的第二指甲檢測框;獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點。In combination with any implementation manner provided in the present disclosure, the first image is a frame in an image sequence, and the device further includes a tracking unit configured to: for a second image after the first image, according to the first image A plurality of first key points of the nail in the previous frame of the second image, determine a second nail detection frame in the second image; obtain the image area corresponding to the second nail detection frame in the second image , a plurality of second key points of the nail.

結合本公開提供的任一實施方式,所述追蹤單元在用於根據所述第二影像的前一幀中的多個第一關鍵點,確定第二影像中的第二指甲檢測框時,具體用於:根據所述前一幀中的所述指甲的多個第一關鍵點,得到所述指甲的外接矩形框;根據所述外接矩形框在所述前一幀中的位置資訊,將所述外接矩形框映射至所述第二影像中,作為所述第二影像中的第二指甲檢測框。In combination with any implementation manner provided by the present disclosure, when the tracking unit is used to determine the second nail detection frame in the second image based on the multiple first key points in the previous frame of the second image, specifically It is used to: obtain the circumscribed rectangular frame of the nail according to the multiple first key points of the nail in the previous frame; obtain the circumscribed rectangular frame according to the position information of the circumscribed rectangular frame in the previous frame. The circumscribed rectangular frame is mapped to the second image as a second nail detection frame in the second image.

結合本公開提供的任一實施方式,所述追蹤單元在用於獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點時,具體用於:裁剪出所述第二影像中所述第二指甲檢測框對應的影像區域;將裁剪出的影像區域輸入至第二關鍵點檢測網路,得到所述指甲的第二關鍵點。In combination with any implementation manner provided by the present disclosure, when the tracking unit is used to obtain multiple second key points of the nail in the image area corresponding to the second nail detection frame in the second image, It is specifically used for: cutting out the image area corresponding to the second nail detection frame in the second image; inputting the cropped image area into the second key point detection network to obtain the second key point of the nail.

結合本公開提供的任一實施方式,所述裝置還包括旋轉單元,用於在將所述裁剪出的影像區域輸入至第二關鍵點檢測網路之前,根據所述前一幀中所述指甲的方向,對所述裁剪出的影像進行旋轉處理。In combination with any of the implementations provided in the present disclosure, the device further includes a rotation unit, configured to, before inputting the cropped image region into the second key point detection network, according to the nail in the previous frame The direction of the cropped image is rotated.

結合本公開提供的任一實施方式,所述裝置還包括判定單元,用於:在未檢測到所述指甲的第二關鍵點或所述指甲的第二關鍵點不符合設定要求的情況下,獲取第二影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;根據所述第一指甲檢測框得到所述第二影像中所述指甲對應的影像區域;根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。In combination with any implementation manner provided by the present disclosure, the device further includes a judging unit configured to: if the second key point of the nail is not detected or the second key point of the nail does not meet the set requirements, Acquiring a detection result of at least one nail in the second image, the detection result including a first nail detection frame and a classification result of the nail, the classification result indicating the finger type to which the nail belongs; according to the first nail detection frame Obtain an image area corresponding to the nail in the second image; and obtain a plurality of first key points of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs.

根據本公開的一方面,提供一種電子設備,所述設備包括儲存器、處理器,所述儲存器用於儲存可在處理器上運行的計算機指令,所述處理器用於在執行所述計算機指令時實現本公開提供的任一實施方式所述的指甲識別方法。According to an aspect of the present disclosure, there is provided an electronic device, the device includes a memory and a processor, the memory is used to store computer instructions executable on the processor, and the processor is used to execute the computer instructions Implement the nail recognition method described in any implementation manner provided by the present disclosure.

根據本公開的一方面,提供一種計算機可讀儲存媒體,其上儲存有計算機程式,所述程式被處理器執行時實現本公開提供的任一實施方式所述的指甲識別方法。According to one aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the nail recognition method described in any implementation manner provided by the present disclosure is implemented.

根據本公開的一方面,提供一種計算機程式產品,包括計算機程式,所述程式被處理器執行時實現本公開提供的任一實施方式所述的指甲識別方法。According to an aspect of the present disclosure, a computer program product is provided, including a computer program, and when the program is executed by a processor, the nail recognition method described in any implementation manner provided in the present disclosure is implemented.

應當理解的是,以上的一般描述和後文的細節描述僅是示例性和解釋性的,並不能限制本說明書。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.

這裡將詳細地對示例性實施例進行說明,其示例表示在附圖中。下面的描述涉及附圖時,除非另有表示,不同附圖中的相同數字表示相同或相似的要素。以下示例性實施例中所描述的實施方式並不代表與本說明書相一致的所有實施方式。相反,它們僅是與如所附申請專利範圍中所詳述的、本說明書的一些方面相一致的裝置和方法的例子。Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with this specification. Rather, they are merely examples of apparatus and methods consistent with aspects of the present specification, as detailed in the appended claims.

在本說明書使用的術語是僅僅出於描述特定實施例的目的,而非旨在限制本說明書。在本說明書和所附申請專利範圍中所使用的單數形式的“一種”、“所述”和“該”也旨在包括多數形式,除非上下文清楚地表示其他含義。還應當理解,本文中使用的術語“和/或”是指並包含一個或多個相關聯的列出項目的任何或所有可能組合。The terms used in this specification are for the purpose of describing particular embodiments only, and are not intended to limit the specification. As used in this specification and the appended claims, the singular forms "a", "the" and "the" are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

應當理解,儘管在本說明書可能採用術語第一、第二、第三等來描述各種資訊,但這些資訊不應限於這些術語。這些術語僅用來將同一類型的資訊彼此區分開。例如,在不脫離本說明書範圍的情況下,第一資訊也可以被稱為第二資訊,類似地,第二資訊也可以被稱為第一資訊。取決於語境,如在此所使用的詞語“如果”可以被解釋成為“在……時”或“當……時”或“響應於確定”。It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various pieces of information, these pieces of information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first information may also be called second information without departing from the scope of this specification, and similarly, second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "at" or "when" or "in response to a determination."

相關技術中,在影像中識別出指甲還停留於對指甲區域的識別,最常用的方法就是分割模型,即,對影像中的每個像素點進行檢測,將屬於指甲的像素點組合起來,作為針對指甲的檢測結果。這種指甲檢測的方式,雖然能夠在影像中將屬於指甲的區域識別出來,但指甲是哪個手指的、哪個手的,以及指甲的朝向,都是上述指甲識別的方式所不能確定的,這大大限制了識別結果在各個應用場景中的使用,例如,在移動互娛、虛擬試妝、虛擬實境VR、擴增實境AR等場景下,用戶想要為指甲添加具有方向的特效,或者為不同的指甲添加不同的特效,那麼就需要在識別指甲時,能夠識別出指甲的類別,或者能夠識別出指甲的朝向等。In related technologies, the recognition of the nail in the image still stops at the recognition of the nail area. The most commonly used method is to segment the model, that is, to detect each pixel in the image and combine the pixels belonging to the nail as Test results for nails. Although this nail detection method can identify the area belonging to the nail in the image, which finger, which hand the nail belongs to, and the orientation of the nail cannot be determined by the above-mentioned nail recognition method, which greatly Limits the use of recognition results in various application scenarios. For example, in scenarios such as mobile entertainment, virtual makeup trial, virtual reality VR, and augmented reality AR, users want to add directional special effects to nails, or for To add different special effects to different nails, it is necessary to be able to identify the type of nails or the orientation of the nails when identifying the nails.

鑒於上述問題,本公開至少一個實施例提供了一種指甲識別方法,該方法可以由終端設備或伺服器等電子設備執行,所述終端設備可以是固定終端或移動終端,例如手機、平板電腦、遊戲機、桌機、廣告機、一體機、車載終端等等,所述伺服器包括本地伺服器或雲端伺服器等,所述方法還可以通過處理器調用儲存器中儲存的計算機可讀指令的方式來實現。In view of the above problems, at least one embodiment of the present disclosure provides a nail recognition method, which can be executed by electronic devices such as terminal devices or servers, and the terminal devices can be fixed terminals or mobile terminals, such as mobile phones, tablet computers, game machine, desktop machine, advertising machine, all-in-one machine, vehicle-mounted terminal, etc., the server includes a local server or a cloud server, etc., and the method can also use the method of calling the computer-readable instructions stored in the memory by the processor to fulfill.

圖1示出根據本公開至少一個實施例的指甲識別方法的流程圖,如圖1所示,所述方法包括步驟101至步驟104。FIG. 1 shows a flowchart of a nail recognition method according to at least one embodiment of the present disclosure. As shown in FIG. 1 , the method includes steps 101 to 104 .

在步驟101中,獲取第一影像中至少一個指甲的檢測結果。In step 101, a detection result of at least one fingernail in a first image is acquired.

其中,所述第一影像可以是即時拍攝的靜態影像或者視頻影像,也可以是從儲存器或者其他媒體中獲取的靜態影像或者視頻影像。並且,本公開實施例中的指甲可以是手部的指甲,也可以是腳部的指甲,本公開對此不進行限制。以所述指甲為手部的指甲為例,所述第一影像可以是單獨的手部影像,或者是包含了手部區域的人體影像;也可以是包含了一個或多個指甲的局部手部影像。Wherein, the first image may be a still image or a video image shot in real time, or may be a still image or a video image acquired from a storage or other media. Moreover, the nails in the embodiments of the present disclosure may be the nails of the hand or the nails of the feet, which is not limited in the present disclosure. Taking the nail as a hand nail as an example, the first image may be a single hand image, or a human body image including the hand area; it may also be a partial hand including one or more nails image.

在本公開實施例中,可以利用指甲檢測網路對所述第一影像進行指甲檢測,得到所述第一影像中至少一個指甲的檢測結果。其中,所述指甲檢測網路為深度學習網路,例如RCNN、Fast RCNN、Faster RCNN等等。所述檢測結果可以包含第一指甲檢測框、第一指甲檢測框的位置資訊、所述指甲的分類結果等,其中,所述分類結果指示所述指甲所屬手指類型。指甲所屬手指類型表示該指甲是哪個手指的指甲,或者該指甲是哪個手的哪個手指的指甲。例如,所述分類結果指示食指,則表明該指甲是食指的指甲;又例如,所述分類結果指示左手大拇指,則表明該指甲是左手大拇指的指甲。In an embodiment of the present disclosure, a nail detection network may be used to perform nail detection on the first image to obtain a detection result of at least one nail in the first image. Wherein, the nail detection network is a deep learning network, such as RCNN, Fast RCNN, Faster RCNN and the like. The detection result may include the first nail detection frame, the location information of the first nail detection frame, the classification result of the nail, etc., wherein the classification result indicates the finger type to which the nail belongs. The finger type to which the nail belongs indicates which finger the nail belongs to, or which finger of which hand the nail belongs to. For example, if the classification result indicates the index finger, it indicates that the nail belongs to the index finger; for another example, if the classification result indicates the left thumb, it indicates that the nail belongs to the left thumb.

在利用指甲檢測網路對所述第一影像進行多目標檢測的情況下,則可以在檢測出指甲的同時,還得到所述指甲的分類結果。In the case of using the nail detection network to perform multi-target detection on the first image, a classification result of the nails can be obtained while detecting the nails.

該指甲檢測網路可以利用如下的樣本影像進行訓練:該樣本影像標註了所包含的至少一個指甲每個的包圍框,並且標註了該包圍框中該指甲所屬類型。The nail detection network can be trained by using the following sample images: the sample images mark the bounding boxes of at least one nail contained in each, and mark the type of the nail in the bounding boxes.

在步驟102中,根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域。其中,所述指甲的檢測框所包圍的影像區域,即為所述指甲對應的影像區域。In step 102, an image area corresponding to the nail in the first image is obtained according to the first nail detection frame. Wherein, the image area surrounded by the detection frame of the nail is the image area corresponding to the nail.

在步驟103中,根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。In step 103, according to the finger type to which the nail belongs, a plurality of first key points of the nail in the image area corresponding to the nail are obtained.

其中,指甲的多個第一關鍵點用於表徵指甲輪廓的不同位置點,其中每個第一關鍵點用於表徵指甲的特定位置點。指甲的輪廓具有一定的特點,通過特定位置點可勾勒出指甲的輪廓。因此,在檢測出所述指甲的多個第一關鍵點的情況下,則可以確定出所述指甲的輪廓,得到所述指甲的邊緣資訊。Wherein, multiple first key points of the nail are used to represent different position points of the nail outline, wherein each first key point is used to represent a specific position point of the nail. The outline of the nail has certain characteristics, and the outline of the nail can be outlined by specific position points. Therefore, when multiple first key points of the nail are detected, the outline of the nail can be determined to obtain edge information of the nail.

在通常情況下,一個指甲可以對應12至32範圍內任意數目的第一關鍵點。以圖2所示的第一關鍵點示意圖為例,一個指甲對應於16個第一關鍵點。如圖2所示,第一關鍵點P1用於表徵位於指甲輪廓最底部的最左側的點,第一關鍵點P5用於表徵位於指甲輪廓最底部的最右側的點,第一關鍵點P11用於表徵位於指甲輪廓的最頂部中間的點。本領域技術人員應當瞭解,圖2所示的指甲對應於16個第一關鍵點僅用於示例,本公開對此不進行限制。In general, one nail can correspond to any number of first key points within the range of 12 to 32. Taking the schematic diagram of the first key point shown in FIG. 2 as an example, one fingernail corresponds to 16 first key points. As shown in Figure 2, the first key point P1 is used to characterize the leftmost point at the bottom of the nail outline, the first key point P5 is used to characterize the rightmost point at the bottom of the nail outline, and the first key point P11 is represented by to characterize the top-most middle point of the nail outline. Those skilled in the art should understand that the nails shown in FIG. 2 corresponding to the 16 first key points are only for example, and the present disclosure is not limited thereto.

不同手指的指甲對應的第一關鍵點數目以及各個第一關鍵點在指甲輪廓上的位置,可以相同,也可以不同。一般情況下,大拇指的指甲面積要大於小拇指的指甲面積,輪廓長度也是如此,因此,大拇指的指甲可以對應於較多數目的第一關鍵點,例如32個;相對地,小拇指的指甲可以對較少數目的第一關鍵點,例如12個。本領域技術人員應當理解,以上所述的第一關鍵數目僅為示例,本公開實施例對此不進行限制。The number of first key points corresponding to nails of different fingers and the position of each first key point on the nail outline may be the same or different. Generally, the nail area of the thumb is larger than that of the little finger, and so is the outline length. Therefore, the nail of the thumb can correspond to a larger number of first key points, such as 32; relatively, the nail of the little finger can correspond to A smaller number of first key points, eg 12. Those skilled in the art should understand that the above-mentioned first key number is only an example, which is not limited by the embodiments of the present disclosure.

在本公開實施例中,可以針對每個指甲所屬手指類型構建相應的第一關鍵點檢測網路,用於對屬於該手指類型的指甲進行指甲關鍵點檢測。例如,在所述指甲的分類結果指示所述指甲屬於左手大拇指的情況下,則調用左手大拇指的第一關鍵點檢測網路對所述指甲對應的影像區域進行指甲關鍵點檢測,得到左手大拇指的指甲上的多個第一關鍵點。In the embodiment of the present disclosure, a corresponding first key point detection network may be constructed for the type of finger to which each nail belongs, for performing nail key point detection on nails belonging to the finger type. For example, when the classification result of the nail indicates that the nail belongs to the thumb of the left hand, the first key point detection network of the thumb of the left hand is called to detect key points of the nail in the image area corresponding to the nail, and the left hand thumb is obtained. Multiple first keys on the nail of the thumb.

在本公開實施例中,獲取第一影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;之後根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域;並根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。通過獲取指甲的分類結果,並根據指甲所屬手指類型獲得相應的指甲對應的第一關鍵點,可以獲得指甲的類別資訊和指甲輪廓的完整語意特徵,便於指甲識別結果在各個場景下的應用。In an embodiment of the present disclosure, a detection result of at least one nail in the first image is acquired, the detection result includes a first nail detection frame and a classification result of the nail, the classification result indicates the finger type to which the nail belongs; then Obtain the image area corresponding to the nail in the first image according to the first nail detection frame; and obtain a plurality of first images of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs. key point. By obtaining the classification results of nails and obtaining the first key point corresponding to the corresponding nails according to the type of finger to which the nails belong, the category information of the nails and the complete semantic features of the nail outline can be obtained, which facilitates the application of the nail recognition results in various scenarios.

在一些實施方式中,可以首先裁剪出所述指甲對應的影像區域,再將裁剪出的影像區域輸入至所述指甲所屬手指類型對應的第一關鍵點檢測網路中,得到所述指甲的多個第一關鍵點。In some implementations, the image area corresponding to the nail can be cropped first, and then the cropped image area can be input into the first key point detection network corresponding to the finger type to which the nail belongs, to obtain multiple the first key point.

通過裁剪出所述指甲對應的影像區域,並根據裁剪出的影像進行指甲關鍵點檢測,可以提高指甲關鍵點檢測的效率和準確度。By cutting out the image area corresponding to the nail, and performing nail key point detection according to the clipped image, the efficiency and accuracy of nail key point detection can be improved.

在一些實施方式中,獲取所述指甲對應的影像區域中各個像素的二分類結果,所述二分類結果指示所述像素為前景像素或背景像素,前景像素即為指甲區域對應的像素,背景像素即為指甲區域以外的區域對應的像素。接下來,可以將所述二分類結果中指示為背景像素的像素設置為第一像素值,其中,所述第一像素值可以為0,或者255,也可以為其他數值,所述第一像素值的取值根據背景顏色的設置具體確定。通過將指示為背景像素的像素設置為第一像素值,可以將所述指甲對應的影像區域中被判斷為背景的影像區域過濾掉,使得所述指甲對應的影像區域中只保留了真實指甲對應的區域。In some embodiments, the binary classification result of each pixel in the image area corresponding to the nail is obtained, and the binary classification result indicates that the pixel is a foreground pixel or a background pixel, the foreground pixel is the pixel corresponding to the nail area, and the background pixel is That is, pixels corresponding to areas other than the nail area. Next, the pixels indicated as background pixels in the binary classification result can be set as the first pixel value, wherein the first pixel value can be 0, or 255, or other values, and the first pixel value The value of the value is determined according to the setting of the background color. By setting the pixels indicated as background pixels as the first pixel value, the image area in the image area corresponding to the nail that is judged to be the background can be filtered out, so that only the real nail corresponding to the nail remains in the image area corresponding to the nail. Area.

在一個示例中,也可以針對裁剪出的影像,根據所述影像中各個像素的二分類結果,將指示為背景像素的像素設置為第一像素值。In an example, for the cropped image, according to the binary classification result of each pixel in the image, the pixels indicated as background pixels may be set as the first pixel value.

通過對所述指甲對應的影像區域中,或者裁剪出的影像中的背景像素進行濾除操作,只保留真實指甲對應的區域,可以減小指甲關鍵點誤檢的機率。By performing a filtering operation on background pixels in the image area corresponding to the nail or in the cropped image, only the area corresponding to the real nail is retained, which can reduce the probability of false detection of nail key points.

在一些實施方式中,可以依據所述指甲的多個第一關鍵點中的至少兩個第一關鍵點在所述影像區域中的位置資訊,確定所述指甲的方向。In some implementations, the direction of the nail can be determined according to position information of at least two first key points of the plurality of first key points of the nail in the image area.

由於所述指甲的每個第一關鍵點表徵一個指甲的特定位置點,因此,根據至少兩個第一關鍵點則可以表示出所述指甲的方向。Since each first key point of the nail represents a specific position point of the nail, the direction of the nail can be represented according to at least two first key points.

通常,可以將指甲的法線所指示的方向、即指甲的生長方向,確定為所述指甲的方向。一般情況下,在所述指甲的多個第一關鍵點中,位於指甲輪廓最底端中間的第一關鍵點與位於最頂端中間的第一關鍵點之間的連線,形成所述指甲的法線,因此,通過所述法線在所述第一影像中,或者在影像坐標系中所指示的方向,可以確定所述指甲的方向。Generally, the direction indicated by the normal line of the nail, that is, the growth direction of the nail, can be determined as the direction of the nail. Generally, among the plurality of first key points of the nail, a line between the first key point located in the middle of the bottommost end of the nail outline and the first key point located in the middle of the topmost end forms the first key point of the nail. The normal, therefore, the direction of the nail can be determined by the direction indicated by the normal in the first image, or in the coordinate system of the image.

如圖2所示,可以將第一關鍵點P3與P11之間的連線,作為所述指甲的法線。在圖2中,P3與P11所形成的法線指示所述第一影像的垂直方向,因此可以確定圖2中指甲的方向為所述第一影像的垂直方向。As shown in FIG. 2 , the line connecting the first key point P3 and P11 may be used as the normal line of the nail. In FIG. 2 , the normal line formed by P3 and P11 indicates the vertical direction of the first image, so it can be determined that the direction of the nail in FIG. 2 is the vertical direction of the first image.

也可以根據所述指甲的多個關鍵點中的其他關鍵點來確定所述指甲的方向,本公開對此不進行限制。The direction of the nail may also be determined according to other key points of the multiple key points of the nail, which is not limited in the present disclosure.

通過獲取所述指甲的方向,便於指甲識別結果在各個場景下的應用,例如在為影像中指甲添加美甲特效的場景中,在獲知指甲的方向的情況下,可以更方便地為指甲添加美甲特效。By obtaining the direction of the nail, it is convenient to apply the nail recognition result in various scenarios. For example, in the scene of adding nail art effects to the nails in the image, it is more convenient to add nail art effects to the nails when the direction of the nails is known. .

在一些實施方式中,可以通過以下方法對所述第一關鍵點檢測網路進行訓練。In some implementation manners, the first key point detection network can be trained by the following method.

獲取樣本影像;其中,所述樣本影像具有標註資訊,所述標註資訊指示與所述樣本影像所屬手指類型對應的第一關鍵點。樣本影像中標註的樣本關鍵點的數目可以是12至32範圍內的任意數目。例如,所述樣本影像中包含食指的指甲,並且在所述食指的指甲邊緣標註了16個樣本關鍵點。其中,每個樣本關鍵點具有序號,如圖2所示,位於指甲輪廓最底部最左側的點為第1號樣本關鍵點,表示為P1,在最底部最右側的點為第5號樣本關鍵點,表示為P5,等等。Acquiring a sample image; wherein, the sample image has annotation information, and the annotation information indicates a first key point corresponding to the finger type to which the sample image belongs. The number of sample key points marked in the sample image can be any number within the range of 12 to 32. For example, the sample image includes the nail of the index finger, and 16 sample key points are marked on the edge of the nail of the index finger. Among them, each sample key point has a serial number, as shown in Figure 2, the point at the bottom and left of the nail contour is the key point of sample No. 1, denoted as P1, and the point at the bottom and right is the key point of sample No. 5 point, denoted as P5, and so on.

將所述樣本影像輸入至所述第一關鍵點檢測網路,得到關鍵點檢測結果。所述關鍵點檢測結果中預測的第一關鍵點的數目與所標註的樣本關鍵點數目相同,並且所述預測的第一關鍵點同樣具有序號。The sample image is input to the first key point detection network to obtain a key point detection result. The number of predicted first key points in the key point detection result is the same as the number of labeled sample key points, and the predicted first key points also have serial numbers.

根據所述關鍵點檢測結果與所述標註資訊之間的差異,對所述第一關鍵點檢測網路的網路參數進行調整。也即,根據各個樣本關鍵點與對應的預測的第一關鍵點之間的差異,調整所述第一關鍵點檢測網路的網路參數。在差異小於設定閾值,或者迭代達到設定次數的情況下,停止訓練,得到完成訓練的第一關鍵點檢測網路。According to the difference between the key point detection result and the annotation information, the network parameters of the first key point detection network are adjusted. That is, the network parameters of the first key point detection network are adjusted according to the difference between each sample key point and the corresponding predicted first key point. When the difference is less than the set threshold, or the iteration reaches the set number of times, the training is stopped, and the first key point detection network that has completed the training is obtained.

通過根據樣本影像中指甲所屬手指類型對指甲進行資訊標註,並利用所述樣本影像對第一關鍵點檢測網路進行訓練,可以實現第一關鍵點檢測網路針對指定手指類型的指甲的識別。By labeling the nails according to the finger type in the sample image, and using the sample image to train the first key point detection network, the first key point detection network can recognize the nail of the specified finger type.

在本公開實施例中,所述第一關鍵點檢測網路可以基於熱度圖進行指甲關鍵點檢測。In an embodiment of the present disclosure, the first key point detection network may perform nail key point detection based on a heat map.

首先,生成所述第一影像中各個第一關鍵點的熱度圖。所述第一關鍵點的熱度圖是該第一關鍵點在所述第一影像中可能存在位置的機率分佈圖。First, a heat map of each first key point in the first image is generated. The heat map of the first key point is a probability distribution map of possible locations of the first key point in the first image.

進而,根據所述第一關鍵點的熱度圖,可以確定所述第一關鍵點在所述第一影像中的坐標。Furthermore, according to the heat map of the first key point, the coordinates of the first key point in the first image can be determined.

根據關鍵點熱度圖可以準確地確定第一影像中各個指甲的第一關鍵點的位置。The position of the first key point of each nail in the first image can be accurately determined according to the key point heat map.

然而,由於基於熱度圖進行指甲關鍵點檢測的第一關鍵點檢測網路結構複雜、層數較多,並且耗時較大,本公開實施例提出了一種指甲關鍵點追蹤方法。在所述第一影像為視頻影像,也即所述第一影像是針對同一場景的影像序列中的一幀的情況下,對於所述第一影像之後的任一幀影像(第二影像),可以採用以下方法進行指甲關鍵點追蹤。However, because the first key point detection network for nail key point detection based on the heat map has a complex structure, a large number of layers, and takes a long time, an embodiment of the present disclosure proposes a nail key point tracking method. When the first image is a video image, that is, the first image is a frame in an image sequence for the same scene, for any frame of image (second image) after the first image, The following methods can be used for nail key point tracking.

首先,根據第二影像的前一幀中所述指甲的多個第一關鍵點,確定所述第二影像中的第二指甲檢測框。Firstly, a second nail detection frame in the second image is determined according to a plurality of first key points of the nail in the previous frame of the second image.

由於同一場景的影像序列中,連續兩幀影像中指甲的位置變化通常較小,因此,根據前一幀中一指甲的多個第一關鍵點,可以確定當前幀(第二影像)中該指甲的第二指甲檢測框。In the image sequence of the same scene, the position of the nail in two consecutive frames of images usually changes little, therefore, according to the multiple first key points of a nail in the previous frame, the nail in the current frame (second image) can be determined The second nail detection frame of .

在一些實施方式中,可以根據所述前一幀中的所述指甲的多個第一關鍵點,得到所述指甲的外接矩形框;根據所述外接矩形框在所述前一幀中的位置資訊,將所述外接矩形框映射至所述第二影像中,也即將所述外接矩形框放置於所述第二影像中與前一幀中相同的位置,作為所述第二影像中的第二指甲檢測框。In some implementation manners, the circumscribed rectangular frame of the nail can be obtained according to a plurality of first key points of the nail in the previous frame; according to the position of the circumscribed rectangular frame in the previous frame information, mapping the circumscribing rectangle to the second image, that is, placing the circumscribing rectangle at the same position in the second image as in the previous frame, as the first frame in the second image 2. Nail detection frame.

通過上述方法得到的第二影像中的第二指甲檢測框,相較於通過指甲檢測到的第一指甲檢測框,更接近指甲的真實區域,且包含更少指甲以外的部分,有利於提高關鍵點檢測的精度。Compared with the first nail detection frame detected by the nail, the second nail detection frame in the second image obtained by the above method is closer to the real area of the nail and contains less parts other than the nail, which is beneficial to improve the key Accuracy of point detection.

在一些實施方式中,可以裁剪出所述第二影像中所述第二指甲檢測框對應的影像區域;將裁剪出的影像區域輸入至第二關鍵點檢測網路,得到所述指甲的第二關鍵點。In some embodiments, the image area corresponding to the second nail detection frame in the second image can be cropped; the cropped image area can be input to the second key point detection network to obtain the second nail detection frame. key point.

在本公開實施例中,所述第二關鍵點檢測網路與所述第一關鍵點檢測網路的作用相同,都可以用於從輸入影像中檢測出指甲關鍵點;並且所述第二關鍵點檢測網路的訓練方法也可以與所述第一關鍵點檢測網路相同。然而,在所述第二檢測框包含指甲以外的部分更少的情況下,可以基於關鍵點回歸的方式,得到各個第二關鍵點在輸入影像中的坐標。In the embodiment of the present disclosure, the function of the second key point detection network is the same as that of the first key point detection network, both of which can be used to detect nail key points from the input image; and the second key point The training method of the point detection network may also be the same as that of the first key point detection network. However, in the case that the second detection frame contains less parts other than nails, the coordinates of each second key point in the input image can be obtained based on key point regression.

由於基於關鍵點回歸進行指甲關鍵點檢測的第二關鍵點檢測網路,相較於基於熱度圖進行指甲關鍵點檢測的第一關鍵點檢測網路,網路結構更簡單、層數較小、處理速度更快,減少了進行指甲關鍵點檢測的耗時。Compared with the first key point detection network based on heat map for nail key point detection, the second key point detection network based on key point regression for nail key point detection has a simpler network structure, fewer layers, The processing speed is faster and the time-consuming for nail keypoint detection is reduced.

在一些實施方式中,在將所述裁剪出的影像輸入至第二關鍵點檢測網路之前,可以根據所述前一幀中所述指甲的方向,對所述裁剪出的影像進行旋轉處理。In some embodiments, before the cropped image is input to the second key point detection network, the cropped image may be rotated according to the direction of the nail in the previous frame.

例如,在所述指甲的方向為法線與影像坐標系中的水平方向夾角為85度時,則可以根據該方向,將所述裁剪出來的影像沿逆時針方向旋轉5度,以使得所述指甲的方向為法線指向豎直方向。For example, when the direction of the nail is an angle of 85 degrees between the normal line and the horizontal direction in the image coordinate system, the cropped image can be rotated counterclockwise by 5 degrees according to the direction, so that the The direction of the nail is that the normal points to the vertical direction.

對旋轉後的影像進行指甲關鍵點檢測,一方面可以提高檢測的效率,一方面也可以提高檢測的精度。The nail key point detection on the rotated image can improve the efficiency of detection on the one hand and the accuracy of detection on the other hand.

在本公開實施例中,通過根據影像序列中前一幀的關鍵點檢測結果,得到當前幀中的關鍵點檢測結果,可以減小數據處理量,提高指甲關鍵點檢測的速度和效率。In the embodiment of the present disclosure, by obtaining the key point detection result in the current frame according to the key point detection result of the previous frame in the image sequence, the amount of data processing can be reduced, and the speed and efficiency of nail key point detection can be improved.

然而,在未檢測到所述指甲的第二關鍵點或所述指甲的第二關鍵點不符合設定要求,例如,檢測出的第二關鍵點超出裁剪出的影像區域的範圍的情況下,則判定追蹤失敗,仍然採用與對所述第一影像進行指甲關鍵點檢測的方法,對所述第二影像進行指甲關鍵點檢測,具體包括:獲取第二影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;根據所述第一指甲檢測框得到所述第二影像中所述指甲對應的影像區域;根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。However, when the second key point of the nail is not detected or the second key point of the nail does not meet the set requirements, for example, if the detected second key point exceeds the scope of the cropped image area, then If it is determined that the tracking fails, the method of detecting the nail key points on the first image is still adopted, and the nail key point detection is performed on the second image, which specifically includes: obtaining a detection result of at least one nail in the second image, and the The detection result includes a first nail detection frame and a classification result of the nail, the classification result indicates the finger type to which the nail belongs; an image area corresponding to the nail in the second image is obtained according to the first nail detection frame Obtaining multiple first key points of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs.

通過對追蹤得到的指甲的第二關鍵點進行判定,在未檢測到或者不符合設定要求的情況下,則重新進行指甲識別,一方面保證了指甲識別結果的連貫性,另一方面也保證了指甲識別結果的準確性。By judging the second key point of the nail tracked, if it is not detected or does not meet the set requirements, the nail recognition will be performed again. On the one hand, it ensures the consistency of the nail recognition results, and on the other hand, it also ensures Accuracy of nail recognition results.

在一些實施方式中,可以通過以下方式對包含手部的視頻影像進行指甲識別。如圖3所示,該方法可以包括步驟301至309。In some implementations, nail recognition can be performed on video images containing hands in the following manner. As shown in FIG. 3 , the method may include steps 301 to 309 .

在步驟301中,對於所述視頻影像所包含的影像序列中的任一幀第一影像,可以利用指甲檢測網路對所述第一影像進行指甲檢測,得到所述第一影像中至少一個指甲的第一指甲檢測框,以及所述指甲的分類結果。其中,所述分類結果指示所述指甲所屬手指類型。In step 301, for any frame of the first image in the image sequence contained in the video image, the nail detection network may be used to perform nail detection on the first image to obtain at least one nail in the first image The first nail detection frame, and the classification result of the nail. Wherein, the classification result indicates the finger type to which the nail belongs.

在通常情況下,所述第一影像為一個場景下的第一幀影像。Usually, the first image is the first frame of image in a scene.

在步驟302中,將所述第一指甲檢測框對應的影像區域剪裁出來,得到第一指甲區域影像。In step 302, the image area corresponding to the first nail detection frame is cut out to obtain a first nail area image.

在步驟303中,獲取所述指甲區域影像中各個像素的二分類結果,所述二分類結果指示所述像素為前景像素或背景像素;將所述二分類結果中指示為背景像素的像素設置為第一像素值。In step 303, the binary classification result of each pixel in the nail region image is obtained, and the binary classification result indicates that the pixel is a foreground pixel or a background pixel; the pixel indicated as a background pixel in the binary classification result is set as The first pixel value.

在步驟304中,將經步驟303處理的指甲區域影像輸入至第一關鍵點檢測網路,得到所述指甲的多個第一關鍵點。In step 304, the nail area image processed in step 303 is input to the first key point detection network to obtain a plurality of first key points of the nail.

在步驟305中,針對所述第一影像之後的第二影像,根據所述第二影像的前一幀中的所述指甲的多個第一關鍵點,得到所述指甲的外接矩形框;根據所述外接矩形框在所述前一幀中的位置資訊,將所述外接矩形框映射至所述第二影像中,作為所述第二影像中的第二指甲檢測框。In step 305, for the second image following the first image, according to the plurality of first key points of the nail in the previous frame of the second image, a circumscribed rectangular frame of the nail is obtained; according to The location information of the circumscribed rectangular frame in the previous frame is used to map the circumscribed rectangular frame to the second image as a second nail detection frame in the second image.

在步驟306中,將所述第二指甲檢測框對應的影像區域剪裁出來,得到第二指甲區域影像。In step 306, the image area corresponding to the second nail detection frame is cut out to obtain a second nail area image.

在步驟307中,根據所述前一幀中所述指甲的方向,對所述第二指甲區域影像進行旋轉,得到旋轉後的影像。其中,所述指甲的方向根據所述指甲的多個第一關鍵點中的至少兩個第一關鍵點在所述前一幀中的位置資訊確定。In step 307, the second nail region image is rotated according to the direction of the nail in the previous frame to obtain a rotated image. Wherein, the direction of the nail is determined according to the position information of at least two first key points among the plurality of first key points of the nail in the previous frame.

在步驟308中,將旋轉後的影像輸入至第二關鍵點檢測網路,得到所述指甲的多個第二關鍵點。In step 308, the rotated image is input to the second key point detection network to obtain a plurality of second key points of the nail.

在步驟309中,對步驟308得到的關鍵點檢測結果進行判定,在所述指甲的多個第二關鍵點滿足設定要求的情況下,判定對所述第二影像追蹤成功,返回至步驟305中,對下一幀影像繼續進行追蹤;在未檢測到第二關鍵點,或在所述指甲的多個第二關鍵點不滿足設定要求的情況下,判定追蹤不成功,則返回至步驟301,將所述第二影像作為第一影像進行處理。In step 309, the key point detection result obtained in step 308 is judged, and if the plurality of second key points of the nail meet the set requirements, it is judged that the tracking of the second image is successful, and the process returns to step 305 , continue to track the next frame of image; if the second key point is not detected, or if multiple second key points of the nail do not meet the set requirements, it is determined that the tracking is unsuccessful, and then return to step 301, Processing the second image as the first image.

圖4是本公開至少一個實施例提出的指甲識別裝置的結構示意圖,如圖4所示,該裝置可以包括:第一獲取單元401,用於獲取第一影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;第二獲取單元402,用於根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域;識別單元403,用於根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。Fig. 4 is a schematic structural diagram of a nail recognition device proposed by at least one embodiment of the present disclosure. As shown in Fig. 4, the device may include: a first acquisition unit 401, configured to acquire a detection result of at least one nail in the first image, so The detection result includes a first nail detection frame and a classification result of the nail, and the classification result indicates the finger type to which the nail belongs; the second acquiring unit 402 is configured to obtain the first nail detection frame according to the first nail detection frame. An image area corresponding to the nail in the image; an identification unit 403 configured to obtain a plurality of first key points of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs.

結合本公開提供的任一實施方式,所述識別單元具體用於:從所述第一影像中裁剪出所述指甲對應的影像區域;將裁剪出的影像區域輸入至所述指甲所屬手指類型對應的第一關鍵點檢測網路中,得到所述指甲的多個第一關鍵點。In combination with any of the implementations provided in the present disclosure, the identification unit is specifically configured to: crop out the image area corresponding to the nail from the first image; input the cropped image area into the In the first key point detection network, multiple first key points of the nail are obtained.

結合本公開提供的任一實施方式,所述裝置還包括過濾單元,用於:獲取所述指甲對應的影像區域中各個像素的二分類結果,所述二分類結果指示所述像素為前景像素或背景像素;將所述二分類結果中指示為背景像素的像素設置為第一像素值。In combination with any embodiment provided in the present disclosure, the device further includes a filtering unit, configured to: obtain a binary classification result of each pixel in the image region corresponding to the nail, the binary classification result indicating that the pixel is a foreground pixel or Background pixels: setting the pixels indicated as background pixels in the binary classification result as the first pixel value.

結合本公開提供的任一實施方式,所述裝置還包括定向單元,用於:依據所述指甲的多個第一關鍵點中的至少兩個第一關鍵點在所述影像區域中的位置資訊,確定所述指甲的方向。In combination with any implementation manner provided by the present disclosure, the device further includes an orientation unit configured to: according to the position information of at least two first key points among the plurality of first key points of the nail in the image area , to determine the orientation of the nail.

結合本公開提供的任一實施方式,所述裝置還包括訓練單元,用於:獲取樣本影像;其中,所述樣本影像具有標註資訊,所述標註資訊指示與所述樣本影像所屬手指類型對應的第一關鍵點;將所述樣本影像輸入至所述第一關鍵點檢測網路,得到關鍵點檢測結果;根據所述關鍵點檢測結果與所述標註資訊之間的差異,對所述第一關鍵點檢測網路的網路參數進行調整。In combination with any of the implementations provided in the present disclosure, the device further includes a training unit configured to: acquire a sample image; wherein, the sample image has annotation information, and the annotation information indicates the finger type corresponding to the sample image. The first key point; input the sample image to the first key point detection network to obtain a key point detection result; according to the difference between the key point detection result and the annotation information, the first key point detection The network parameters of the keypoint detection network are tuned.

結合本公開提供的任一實施方式,所述第一影像是影像序列中的一幀,所述裝置還包括追蹤單元,用於:對於所述第一影像之後的第二影像,根據所述第二影像的前一幀中所述指甲的多個第一關鍵點,確定第二影像中的第二指甲檢測框;獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點。In combination with any implementation manner provided in the present disclosure, the first image is a frame in an image sequence, and the device further includes a tracking unit configured to: for a second image after the first image, according to the first image A plurality of first key points of the nail in the previous frame of the second image, determine a second nail detection frame in the second image; obtain the image area corresponding to the second nail detection frame in the second image , a plurality of second key points of the nail.

結合本公開提供的任一實施方式,所述追蹤單元在用於根據所述第二影像的前一幀中的多個第一關鍵點,確定第二影像中的第二指甲檢測框時,具體用於:根據所述前一幀中的所述指甲的多個第一關鍵點,得到所述指甲的外接矩形框;根據所述外接矩形框在所述前一幀中的位置資訊,將所述外接矩形框映射至所述第二影像中,作為所述第二影像中的第二指甲檢測框。In combination with any implementation manner provided by the present disclosure, when the tracking unit is used to determine the second nail detection frame in the second image based on the multiple first key points in the previous frame of the second image, specifically It is used to: obtain the circumscribed rectangular frame of the nail according to the multiple first key points of the nail in the previous frame; obtain the circumscribed rectangular frame according to the position information of the circumscribed rectangular frame in the previous frame. The circumscribed rectangular frame is mapped to the second image as a second nail detection frame in the second image.

結合本公開提供的任一實施方式,所述追蹤單元在用於獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點時,具體用於:裁剪出所述第二影像中所述第二指甲檢測框對應的影像區域;將裁剪出的影像區域輸入至第二關鍵點檢測網路,得到所述指甲的第二關鍵點。In combination with any implementation manner provided by the present disclosure, when the tracking unit is used to obtain multiple second key points of the nail in the image area corresponding to the second nail detection frame in the second image, It is specifically used for: cutting out the image area corresponding to the second nail detection frame in the second image; inputting the cropped image area into the second key point detection network to obtain the second key point of the nail.

結合本公開提供的任一實施方式,所述裝置還包括旋轉單元,用於在將所述裁剪出的影像區域輸入至第二關鍵點檢測網路之前,根據所述前一幀中所述指甲的方向,對所述裁剪出的影像進行旋轉處理。In combination with any of the implementations provided in the present disclosure, the device further includes a rotation unit, configured to, before inputting the cropped image region into the second key point detection network, according to the nail in the previous frame The direction of the cropped image is rotated.

結合本公開提供的任一實施方式,所述裝置還包括判定單元,用於:在未檢測到所述指甲的第二關鍵點或所述指甲的第二關鍵點不符合設定要求的情況下,獲取第二影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型;根據所述第一指甲檢測框得到所述第二影像中所述指甲對應的影像區域;根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。In combination with any implementation manner provided by the present disclosure, the device further includes a judging unit configured to: if the second key point of the nail is not detected or the second key point of the nail does not meet the set requirements, Acquiring a detection result of at least one nail in the second image, the detection result including a first nail detection frame and a classification result of the nail, the classification result indicating the finger type to which the nail belongs; according to the first nail detection frame Obtain an image area corresponding to the nail in the second image; and obtain a plurality of first key points of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs.

本公開至少一個實施例還提供了一種電子設備,如圖5所示,所述設備包括儲存器501、處理器502,儲存器用於儲存可在處理器上運行的計算機指令,處理器用於在執行所述計算機指令時實現本公開任一實施例所述的影像處理方法。At least one embodiment of the present disclosure also provides an electronic device. As shown in FIG. 5 , the device includes a storage 501 and a processor 502. The computer instructions implement the image processing method described in any embodiment of the present disclosure.

本公開至少一個實施例還提供了一種計算機可讀儲存媒體,其上儲存有計算機程式,所述程式被處理器執行時實現本公開任一實施例所述的影像處理方法。At least one embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image processing method described in any embodiment of the present disclosure is implemented.

本公開至少一個實施例還提供了一種計算機程式產品,包括計算機程式,所述程式被處理器執行時實現本公開任一實施例所述的影像處理方法。At least one embodiment of the present disclosure further provides a computer program product, including a computer program, which implements the image processing method described in any embodiment of the present disclosure when the program is executed by a processor.

本領域技術人員應明白,本說明書一個或多個實施例可提供為方法、系統或計算機程式產品。因此,本說明書一個或多個實施例可採用完全硬體實施例、完全軟體實施例或結合軟體和硬體方面的實施例的形式。而且,本說明書一個或多個實施例可採用在一個或多個其中包含有計算機可用程式代碼的計算機可用儲存媒體(包括但不限於磁碟儲存器、CD-ROM、光學儲存器等)上實施的計算機程式產品的形式。Those skilled in the art should understand that one or more embodiments of this specification may be provided as a method, system or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may be implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. in the form of computer program products.

本說明書中的各個實施例均採用遞進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於數據處理設備實施例而言,由於其基本相似於方法實施例,所以描述的比較簡單,相關之處參見方法實施例的部分說明即可。Each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the data processing device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to part of the description of the method embodiment.

上述對本說明書特定實施例進行了描述。其它實施例在所附申請專利範圍的範圍內。在一些情況下,在申請專利範圍中記載的行為或步驟可以按照不同於實施例中的順序來執行並且仍然可以實現期望的結果。另外,在附圖中描繪的過程不一定要求示出的特定順序或者連續順序才能實現期望的結果。在某些實施方式中,多任務處理和並行處理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that in the examples and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.

本說明書中描述的主題及功能操作的實施例可以在以下中實現:數位電子電路、有形體現的計算機軟體或韌體、包括本說明書中公開的結構及其結構性等同物的計算機硬體、或者它們中的一個或多個的組合。本說明書中描述的主題的實施例可以實現為一個或多個計算機程式,即編碼在有形非暫時性程式載體上以被數據處理裝置執行或控制數據處理裝置的操作的計算機程式指令中的一個或多個模組。可替代地或附加地,程式指令可以被編碼在人工生成的傳播訊號上,例如機器生成的電、光或電磁訊號,該訊號被生成以將資訊編碼並傳輸到合適的接收機裝置以由數據處理裝置執行。計算機儲存媒體可以是機器可讀儲存設備、機器可讀儲存基板、隨機或串行存取記憶體設備、或它們中的一個或多個的組合。Embodiments of the subject matter and functional operations described in this specification can be implemented in digital electronic circuitry, tangibly embodied computer software or firmware, computer hardware including the structures disclosed in this specification and their structural equivalents, or A combination of one or more of them. Embodiments of the subject matter described in this specification can be implemented as one or more computer programs, that is, one or more of computer program instructions encoded on a tangible, non-transitory program carrier for execution by or to control the operation of data processing apparatus. Multiple mods. Alternatively or additionally, the program instructions may be encoded on an artificially generated propagated signal, such as a machine-generated electrical, optical or electromagnetic signal, which is generated to encode and transmit information to a suitable receiver device for transmission by the data The processing means executes. The computer storage medium can be a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them.

本說明書中描述的處理及邏輯流程可以由執行一個或多個計算機程式的一個或多個可編程計算機執行,以通過根據輸入數據進行操作並生成輸出來執行相應的功能。所述處理及邏輯流程還可以由專用邏輯電路—例如FPGA(現場可程式邏輯閘陣列)或ASIC(特殊應用積體電路)來執行,並且裝置也可以實現為專用邏輯電路。The processes and logic flows described in this specification can be performed by one or more programmable computers executing one or more computer programs to perform corresponding functions by operating on input data and generating output. The processes and logic flows can also be performed by, and devices can also be implemented as, special purpose logic circuits, such as FPGAs (Field Programmable Gate Arrays) or ASICs (Application Specific Integrated Circuits).

適合用於執行計算機程式的計算機包括,例如通用和/或專用微處理器,或任何其他類型的中央處理單元。通常,中央處理單元將從唯讀記憶體和/或隨機存取記憶體接收指令和數據。計算機的基本組件包括用於實施或執行指令的中央處理單元以及用於儲存指令和數據的一個或多個儲存器設備。通常,計算機還將包括用於儲存數據的一個或多個大容量儲存設備,例如磁碟、磁光碟或光碟等,或者計算機將可操作地與此大容量儲存設備耦接以從其接收數據或向其傳送數據,抑或兩種情況兼而有之。然而,計算機不是必須具有這樣的設備。此外,計算機可以嵌入在另一設備中,例如移動電話、個人數位助理(PDA)、移動音頻或視頻播放器、遊戲操縱臺、全球定位系統(GPS)接收機、或例如通用串行匯流排(USB)快閃記憶體驅動器的便攜式儲存設備,僅舉幾例。Computers suitable for the execution of computer programs include, for example, general and/or special purpose microprocessors, or any other type of central processing unit. Typically, a central processing unit will receive instructions and data from read only memory and/or random access memory. The basic components of a computer include a central processing unit for implementing or executing instructions and one or more memory devices for storing instructions and data. Typically, a computer will also include, or be operatively coupled to, one or more mass storage devices for storing data, such as magnetic, magneto-optical, or optical disks, to receive data therefrom or Send data to it, or both. However, a computer is not required to have such a device. Additionally, a computer may be embedded in another device such as a mobile phone, personal digital assistant (PDA), mobile audio or video player, game console, Global Positioning System (GPS) receiver, or USB) flash memory drives, to name a few.

適合於儲存計算機程式指令和數據的計算機可讀媒體包括所有形式的非揮發性記憶體、媒介和儲存器設備,例如包括半導體儲存器設備(例如EPROM、EEPROM和快閃記憶體設備)、磁碟(例如內部硬碟或可移動碟)、磁光碟以及CD ROM和DVD-ROM。處理器和儲存器可由專用邏輯電路補充或併入專用邏輯電路中。Computer-readable media suitable for storing computer program instructions and data include all forms of non-volatile memory, media and storage devices including, for example, semiconductor memory devices (such as EPROM, EEPROM and flash memory devices), magnetic disks (such as internal hard disk or removable disk), magneto-optical disk, and CD ROM and DVD-ROM. The processor and memory can be supplemented by, or incorporated in, special purpose logic circuitry.

雖然本說明書包含許多具體實施細節,但是這些不應被解釋為限制任何發明的範圍或所要求保護的範圍,而是主要用於描述特定發明的具體實施例的特徵。本說明書內在多個實施例中描述的某些特徵也可以在單個實施例中被組合實施。另一方面,在單個實施例中描述的各種特徵也可以在多個實施例中分開實施或以任何合適的子組合來實施。此外,雖然特徵可以如上所述在某些組合中起作用並且甚至最初如此要求保護,但是來自所要求保護的組合中的一個或多個特徵在一些情況下可以從該組合中去除,並且所要求保護的組合可以指向子組合或子組合的變型。While this specification contains many specific implementation details, these should not be construed as limitations on the scope of any inventions or of what may be claimed, but rather as primarily describing features of particular embodiments of particular inventions. Certain features that are described in this specification in multiple embodiments can also be implemented in combination in a single embodiment. On the other hand, various features that are described in a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination. Furthermore, although features may function in certain combinations as described above and even be initially so claimed, one or more features from a claimed combination may in some cases be removed from that combination and the claimed A protected combination can point to a subcombination or a variant of a subcombination.

類似地,雖然在附圖中以特定順序描繪了操作,但是這不應被理解為要求這些操作以所示的特定順序執行或順次執行、或者要求所有例示的操作被執行,以實現期望的結果。在某些情況下,多任務和並行處理可能是有利的。此外,上述實施例中的各種系統模組和組件的分離不應被理解為在所有實施例中均需要這樣的分離,並且應當理解,所描述的程式組件和系統通常可以一起整合在單個軟體產品中,或者封裝成多個軟體產品。Similarly, while operations are depicted in the drawings in a particular order, this should not be construed as requiring that those operations be performed in the particular order shown, or sequentially, or that all illustrated operations be performed, to achieve desirable results . In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system modules and components in the above-described embodiments should not be understood as requiring such separation in all embodiments, and it should be understood that the described program components and systems can often be integrated together in a single software product in, or packaged into multiple software products.

由此,主題的特定實施例已被描述。其他實施例在所附申請專利範圍的範圍以內。在某些情況下,申請專利範圍中記載的動作可以以不同的順序執行並且仍實現期望的結果。此外,附圖中描繪的處理並非必需所示的特定順序或順次順序,以實現期望的結果。在某些實現中,多任務和並行處理可能是有利的。Thus, certain embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some implementations, multitasking and parallel processing may be advantageous.

以上所述僅為本說明書一個或多個實施例的較佳實施例而已,並不用以限制本說明書一個或多個實施例,凡在本說明書一個或多個實施例的精神和原則之內,所做的任何修改、等同替換、改進等,均應包含在本說明書一個或多個實施例。The above descriptions are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Within the spirit and principles of one or more embodiments of this specification, Any modification, equivalent replacement, improvement, etc. should be included in one or more embodiments of this specification.

101:獲取第一影像中至少一個指甲的檢測結果 102:根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域 103:根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點 P1~P16:第一關鍵點 301:對於所述視頻影像所包含的影像序列中的任一幀第一影像,可以利用指甲檢測網路對所述第一影像進行指甲檢測,得到所述第一影像中至少一個指甲的第一指甲檢測框,以及所述指甲的分類結果 302:將所述第一指甲檢測框對應的影像區域剪裁出來,得到第一指甲區域影像 303:獲取所述指甲區域影像中各個像素的二分類結果,將所述二分類結果中指示為背景像素的像素設置為第一像素值 304:將經步驟303處理的指甲區域影像輸入至第一關鍵點檢測網路,得到所述指甲的多個第一關鍵點 305:針對所述第一影像之後的第二影像,根據所述第二影像的前一幀中的所述指甲的多個第一關鍵點,得到所述指甲的外接矩形框;根據所述外接矩形框在所述前一幀中的位置資訊,將所述外接矩形框映射至所述第二影像中,作為所述第二影像中的第二指甲檢測框 306:將所述第二指甲檢測框對應的影像區域剪裁出來,得到第二指甲區域影像 307:根據所述前一幀中所述指甲的方向,對所述第二指甲區域影像進行旋轉,得到旋轉後的影像 308:將旋轉後的影像輸入至第二關鍵點檢測網路,得到所述指甲的多個第二關鍵點 309:對步驟308得到的關鍵點檢測結果進行判定 401:第一獲取單元 402:第二獲取單元 403:識別單元 501:儲存器 502:處理器 101: Obtain the detection result of at least one nail in the first image 102: Obtain the image area corresponding to the nail in the first image according to the first nail detection frame 103: According to the type of finger to which the nail belongs, obtain a plurality of first key points of the nail in the image area corresponding to the nail P1~P16: The first key point 301: For any frame of the first image in the image sequence included in the video image, the nail detection network may be used to perform nail detection on the first image to obtain the first frame of at least one nail in the first image. The nail detection frame, and the classification result of the nail 302: Cut out the image area corresponding to the first nail detection frame to obtain the first nail area image 303: Obtain the binary classification result of each pixel in the nail region image, and set the pixel indicated as background pixel in the binary classification result as the first pixel value 304: Input the image of the nail area processed in step 303 to the first key point detection network to obtain a plurality of first key points of the nail 305: For the second image after the first image, according to the multiple first key points of the nail in the previous frame of the second image, obtain the circumscribed rectangular frame of the nail; according to the circumscribed The position information of the rectangular frame in the previous frame, mapping the circumscribed rectangular frame to the second image as the second nail detection frame in the second image 306: Cut out the image area corresponding to the second nail detection frame to obtain the second nail area image 307: Rotate the second nail region image according to the direction of the nail in the previous frame to obtain a rotated image 308: Input the rotated image to the second key point detection network to obtain multiple second key points of the nail 309: determine the key point detection result obtained in step 308 401: The first acquisition unit 402: The second acquisition unit 403: Identification unit 501: storage 502: Processor

圖1是本公開至少一個實施例提出的一種指甲識別方法的流程圖。 圖2是本公開至少一個實施例提出的指甲識別方法中指甲的第一關鍵點示意圖。 圖3是本公開至少一個實施例提出的另一種指甲識別方法的流程圖。 圖4是本公開至少一個實施例提出的指甲識別裝置的結構示意圖。 圖5是本公開至少一個實施例提出的電子設備的結構示意圖。 Fig. 1 is a flow chart of a nail recognition method proposed by at least one embodiment of the present disclosure. Fig. 2 is a schematic diagram of a first key point of a nail in a nail recognition method proposed by at least one embodiment of the present disclosure. Fig. 3 is a flowchart of another nail recognition method proposed by at least one embodiment of the present disclosure. Fig. 4 is a schematic structural diagram of a nail recognition device proposed by at least one embodiment of the present disclosure. Fig. 5 is a schematic structural diagram of an electronic device proposed by at least one embodiment of the present disclosure.

101:獲取第一影像中至少一個指甲的檢測結果 101: Obtain the detection result of at least one nail in the first image

102:根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域 102: Obtain the image area corresponding to the nail in the first image according to the first nail detection frame

103:根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點 103: According to the type of finger to which the nail belongs, obtain a plurality of first key points of the nail in the image area corresponding to the nail

Claims (13)

一種指甲識別方法,其特徵在於,所述方法包括: 獲取第一影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型; 根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域; 根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。 A nail recognition method, characterized in that the method comprises: Acquiring a detection result of at least one nail in the first image, the detection result comprising a first nail detection frame and a classification result of the nail, the classification result indicating the finger type to which the nail belongs; Obtaining an image area corresponding to the nail in the first image according to the first nail detection frame; According to the finger type to which the nail belongs, a plurality of first key points of the nail in the image area corresponding to the nail are obtained. 如請求項1所述的方法,其特徵在於,所述根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中,所述指甲的多個第一關鍵點,包括: 從所述第一影像中裁剪出所述指甲對應的影像區域; 將所述裁剪出的影像區域輸入至所述指甲所屬手指類型對應的第一關鍵點檢測網路中,得到所述指甲的多個第一關鍵點。 The method according to claim 1, wherein, according to the finger type to which the nail belongs, obtaining a plurality of first key points of the nail in the image area corresponding to the nail includes: cutting out an image area corresponding to the nail from the first image; The cropped image area is input into the first key point detection network corresponding to the finger type to which the nail belongs, to obtain a plurality of first key points of the nail. 如請求項1或2所述的方法,其特徵在於,所述方法還包括: 獲取所述指甲對應的影像區域中各個像素的二分類結果,所述二分類結果指示所述像素為前景像素或背景像素; 將所述二分類結果中指示為背景像素的像素設置為第一像素值。 The method according to claim 1 or 2, wherein the method further comprises: Obtaining a binary classification result of each pixel in the image region corresponding to the nail, the binary classification result indicating that the pixel is a foreground pixel or a background pixel; Set the pixels indicated as background pixels in the binary classification result as the first pixel value. 如請求項1或2所述的方法,其特徵在於,所述方法還包括: 依據所述指甲的多個第一關鍵點中的至少兩個第一關鍵點在所述影像區域中的位置資訊,確定所述指甲的方向。 The method according to claim 1 or 2, wherein the method further comprises: The direction of the nail is determined according to the position information of at least two first key points of the plurality of first key points of the nail in the image area. 如請求項2所述的方法,其特徵在於,所述方法還包括: 獲取樣本影像;其中,所述樣本影像具有標註資訊,所述標註資訊指示與所述樣本影像所屬手指類型對應的第一關鍵點; 將所述樣本影像輸入至所述第一關鍵點檢測網路,得到關鍵點檢測結果; 根據所述關鍵點檢測結果與所述標註資訊之間的差異,對所述第一關鍵點檢測網路的網路參數進行調整。 The method as described in claim 2, wherein the method further comprises: Acquiring a sample image; wherein, the sample image has annotation information, and the annotation information indicates a first key point corresponding to the type of finger to which the sample image belongs; inputting the sample image into the first key point detection network to obtain a key point detection result; According to the difference between the key point detection result and the annotation information, the network parameters of the first key point detection network are adjusted. 如請求項1、2、5任一項所述的方法,其特徵在於,所述第一影像是影像序列中的一幀,所述方法還包括: 對於所述第一影像之後的第二影像,根據所述第二影像的前一幀中所述指甲的多個第一關鍵點,確定所述第二影像中的第二指甲檢測框; 獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點。 The method according to any one of claims 1, 2, and 5, wherein the first image is a frame in an image sequence, and the method further includes: For a second image following the first image, determine a second nail detection frame in the second image according to a plurality of first key points of the nail in a previous frame of the second image; Obtaining multiple second key points of the nail in the image area corresponding to the second nail detection frame in the second image. 如請求項6所述的方法,其特徵在於,所述根據所述第二影像的前一幀中的多個第一關鍵點,確定所述第二影像中的第二指甲檢測框,包括: 根據所述前一幀中的所述指甲的多個第一關鍵點,得到所述指甲的外接矩形框; 根據所述外接矩形框在所述前一幀中的位置資訊,將所述外接矩形框映射至所述第二影像中,作為所述第二影像中的第二指甲檢測框。 The method according to claim 6, wherein the determining the second nail detection frame in the second image according to a plurality of first key points in the previous frame of the second image includes: Obtaining a circumscribed rectangular frame of the nail according to a plurality of first key points of the nail in the previous frame; According to the position information of the circumscribing rectangle in the previous frame, the circumscribing rectangle is mapped to the second image as a second nail detection frame in the second image. 如請求項6所述的方法,其特徵在於,所述獲得在所述第二影像中所述第二指甲檢測框對應的影像區域中,所述指甲的多個第二關鍵點,包括: 裁剪出所述第二影像中所述第二指甲檢測框對應的影像區域; 將所述裁剪出的影像區域輸入至第二關鍵點檢測網路,得到所述指甲的第二關鍵點。 The method according to claim 6, wherein the obtaining multiple second key points of the nail in the image area corresponding to the second nail detection frame in the second image includes: cropping out the image area corresponding to the second nail detection frame in the second image; The clipped image area is input to the second key point detection network to obtain the second key point of the nail. 如請求項8所述的方法,其特徵在於,在將所述裁剪出的影像區域輸入至第二關鍵點檢測網路之前,根據所述前一幀中所述指甲的方向,對所述裁剪出的影像進行旋轉處理。The method according to claim 8, wherein, before inputting the cropped image area to the second key point detection network, according to the direction of the nail in the previous frame, the cropped The output image is rotated. 如請求項6任一項所述的方法,其特徵在於,所述方法還包括: 在未檢測到所述指甲的第二關鍵點或所述指甲的第二關鍵點不符合設定要求的情況下,獲取所述第二影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型; 根據所述第一指甲檢測框得到所述第二影像中所述指甲對應的影像區域; 根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。 The method according to any one of claim 6, wherein the method further comprises: In the case that the second key point of the nail is not detected or the second key point of the nail does not meet the set requirements, the detection result of at least one nail in the second image is obtained, and the detection result includes the first A nail detection frame and a classification result of the nail, the classification result indicating the finger type to which the nail belongs; Obtain an image area corresponding to the nail in the second image according to the first nail detection frame; According to the finger type to which the nail belongs, a plurality of first key points of the nail in the image area corresponding to the nail are obtained. 一種指甲識別裝置,其特徵在於,所述裝置包括: 第一獲取單元,用於獲取第一影像中至少一個指甲的檢測結果,所述檢測結果包含第一指甲檢測框以及所述指甲的分類結果,所述分類結果指示所述指甲所屬手指類型; 第二獲取單元,用於根據所述第一指甲檢測框得到所述第一影像中所述指甲對應的影像區域; 識別單元,用於根據所述指甲所屬手指類型,獲得在所述指甲對應的影像區域中所述指甲的多個第一關鍵點。 A nail recognition device, characterized in that the device comprises: A first acquiring unit, configured to acquire a detection result of at least one nail in the first image, the detection result including a first nail detection frame and a classification result of the nail, the classification result indicating the finger type to which the nail belongs; A second acquisition unit, configured to obtain an image area corresponding to the nail in the first image according to the first nail detection frame; The identification unit is configured to obtain a plurality of first key points of the nail in the image area corresponding to the nail according to the finger type to which the nail belongs. 一種電子設備,其特徵在於,所述設備包括儲存器、處理器,所述儲存器用於儲存可在處理器上運行的計算機指令,所述處理器用於在執行所述計算機指令時實現請求項1至10任一項所述的方法。An electronic device, characterized in that the device includes a memory and a processor, the memory is used to store computer instructions that can be run on the processor, and the processor is used to realize claim 1 when executing the computer instructions to the method described in any one of 10. 一種計算機可讀儲存媒體,其上儲存有計算機程式,其特徵在於,所述程式被處理器執行時實現請求項1至10任一所述的方法。A computer-readable storage medium, on which a computer program is stored, is characterized in that, when the program is executed by a processor, the method described in any one of claims 1 to 10 is implemented.
TW110148657A 2021-06-30 2021-12-24 Nail recognation methods, apparatuses, devices and storage media TW202303451A (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110736401.3 2021-06-30
CN202110736401.3A CN113486761A (en) 2021-06-30 2021-06-30 Nail identification method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
TW202303451A true TW202303451A (en) 2023-01-16

Family

ID=77937059

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110148657A TW202303451A (en) 2021-06-30 2021-12-24 Nail recognation methods, apparatuses, devices and storage media

Country Status (3)

Country Link
CN (1) CN113486761A (en)
TW (1) TW202303451A (en)
WO (1) WO2023273227A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113486761A (en) * 2021-06-30 2021-10-08 北京市商汤科技开发有限公司 Nail identification method, device, equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2544971B (en) * 2015-11-27 2017-12-27 Holition Ltd Locating and tracking fingernails in images
CN109829463A (en) * 2019-01-23 2019-05-31 深圳市邻友通科技发展有限公司 A kind of nail recognition methods, device, nail beauty machine and storage medium
CN111047526B (en) * 2019-11-22 2023-09-26 北京达佳互联信息技术有限公司 Image processing method and device, electronic equipment and storage medium
SG10201912990QA (en) * 2019-12-23 2020-11-27 Sensetime Int Pte Ltd Gesture Recognition Method And Apparatus, Electronic Device, And Storage Medium
CN111739028A (en) * 2020-05-26 2020-10-02 华南理工大学 Nail region image acquisition method, system, computing device and storage medium
CN112183388A (en) * 2020-09-30 2021-01-05 北京字节跳动网络技术有限公司 Image processing method, apparatus, device and medium
CN112200183A (en) * 2020-09-30 2021-01-08 北京字节跳动网络技术有限公司 Image processing method, device, equipment and computer readable medium
CN113486761A (en) * 2021-06-30 2021-10-08 北京市商汤科技开发有限公司 Nail identification method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113486761A (en) 2021-10-08
WO2023273227A1 (en) 2023-01-05

Similar Documents

Publication Publication Date Title
US10936911B2 (en) Logo detection
Huang et al. A coarse-to-fine algorithm for matching and registration in 3D cross-source point clouds
US9087403B2 (en) Maintaining continuity of augmentations
CN110060276B (en) Object tracking method, tracking processing method, corresponding device and electronic equipment
US20230376527A1 (en) Generating congruous metadata for multimedia
US11704357B2 (en) Shape-based graphics search
CN110197149B (en) Ear key point detection method and device, storage medium and electronic equipment
CN106529573A (en) Real-time object detection method based on combination of three-dimensional point cloud segmentation and local feature matching
CN107610151B (en) Pedestrian trajectory processing method/system, computer-readable storage medium and device
US20150095360A1 (en) Multiview pruning of feature database for object recognition system
US20170323149A1 (en) Rotation invariant object detection
Tan et al. Distinctive accuracy measurement of binary descriptors in mobile augmented reality
WO2024012333A1 (en) Pose estimation method and apparatus, related model training method and apparatus, electronic device, computer readable medium and computer program product
CN112241736B (en) Text detection method and device
CN110544268B (en) Multi-target tracking method based on structured light and SiamMask network
WO2019100348A1 (en) Image retrieval method and device, and image library generation method and device
Khandelwal et al. Detection of features to track objects and segmentation using grabcut for application in marker-less augmented reality
WO2023273227A1 (en) Fingernail recognition method and apparatus, device, and storage medium
CN110910478B (en) GIF map generation method and device, electronic equipment and storage medium
JP2006260311A (en) Matching method, matching device, and program
Yang et al. Keyframe-based camera relocalization method using landmark and keypoint matching
CN115004245A (en) Target detection method, target detection device, electronic equipment and computer storage medium
CN115210758A (en) Motion blur robust image feature matching
CN116259072B (en) Animal identification method, device, equipment and storage medium
Plósz et al. Practical aspects of visual recognition for indoor mobile positioning