年齢、性別推定プロジェクトに取り組んでいます。これまでは、性別分類のためにLBP(Local Binary Patterns)+ SVM(Support Vector Machines)を試してきましたが、LBP + SVMで作業している間に偽陽性が増えすぎているので、HOG(Histogram of Gradients) )+ SVMとなり、驚くほど正確度は90%まで向上しました。だから私は両方の記述子の機能を併合し、それを使ってSVMを訓練します。これは、次のようなコードは次のとおりです。LBPとHOGの特徴記述子をマージする
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
fd = hog(gray, orientations, pixels_per_cell, cells_per_block, visualize, normalize) #HOG descriptor here.
hist = desc.describe(gray) #get the LBP histogram here.
# extract the label from the image path, then update the
# label and data lists
labels.append(imagePath.split("/")[-2])
data.append(fd + hist) # tried concatinate both featurs, but gives error on this line.
# train a Linear SVM on the data
model = LinearSVC(C=100.0, random_state=42)
model.fit(data, labels)
しかし、ときに、この行を試みた:data.append(fd + hist)
は、単に機能discriptorsの両方をCONCATしようとすると、エラー次のように私をスロー:
Traceback (most recent call last): File "/home/swap/Ubuntu-Home/swap/openCV/gender_age_weight_recog/tarin.py",
line 41, in data.append(fd+hist) ValueError: operands could not be broadcast together with shapes (11340,) (26,)
だから誰かが私を指すことができます2つのフィーチャを1つにまとめてSVMを訓練してください。
+1です。私の好きなだけでなく、新しい答えが出てきたら私が従うことができます。私の提案は、各画像に対してHOGとLBPのヒストグラムのタプルを含むリストを割り当てる方法です。タプルには、各画像のHOGとLBPの両方のヒストグラムが含まれます。これらのタプルはすべてリスト内で取得できます。 –
ええ、それは良いものです、それを試してみましょう! –