|
|
@ -70,7 +70,7 @@ void ofApp::update(){ |
|
|
|
Create a dummy initial input of batch_size = 5, as |
|
|
|
when initialising the model, it will attempt to create a space in memory for this array. |
|
|
|
If the batch_size does change it will completely slow down inference, due to how the cudnn_search_algo is set. |
|
|
|
None of the other search alogithms bar EXHAUSTIVE will work.. no idead why. |
|
|
|
None of the other search alogithms bar EXHAUSTIVE will work.. no idea why. |
|
|
|
*/ |
|
|
|
for(int i = 0; i < emotionImageMaxBatchSize; i++){ |
|
|
|
tempImage.setFromPixels(emoteImage.getPixels()); |
|
|
@ -137,19 +137,17 @@ void ofApp::inferEmotionalState(){ |
|
|
|
auto output_shap = output_tensor.GetTensorTypeAndShapeInfo().GetShape(); |
|
|
|
size_t batch_size = output_shap[0]; // Number of images in the batch
|
|
|
|
size_t num_classes = output_shap[1]; // Number of emotion classes
|
|
|
|
std::cout << batch_size << " : " << num_classes << std::endl; |
|
|
|
|
|
|
|
// for(int i = 0; i < max_faces_to_process; ++i){
|
|
|
|
// auto& face = detected_faces[i];
|
|
|
|
// faceDetector.CropFaceToImage(img, face, emoteImage);
|
|
|
|
// tempImage.setFromPixels(emoteImage.getPixels());
|
|
|
|
// auto emotion_output_tensor = emotion.Run(tempImage);
|
|
|
|
// float* emotional_data = emotion_output_tensor.front().GetTensorMutableData<float>();
|
|
|
|
// emotion.Softmax(emotional_data, 7);
|
|
|
|
// face.box.SetEmotionState(emotional_data);
|
|
|
|
// }
|
|
|
|
|
|
|
|
std::cout << croppedFaces.size() << std::endl; |
|
|
|
float* emotional_data = output_tensor.GetTensorMutableData<float>(); |
|
|
|
|
|
|
|
for (size_t i = 0; i < max_faces_to_process; i++){ |
|
|
|
|
|
|
|
float* emotion_values = emotional_data + i * num_classes; |
|
|
|
|
|
|
|
emotion.Softmax(emotion_values, num_classes); |
|
|
|
|
|
|
|
detected_faces[i].box.SetEmotionState(emotion_values); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//--------------------------------------------------------------
|
|
|
|