Skip to content

Commit

Permalink
Merge masterinto develop (#261)
Browse files Browse the repository at this point in the history
* Synchronize master and develop workflows (#236)

* Synchronize master and develop workflows

* comment

* Added OpenDR citation (#238)

* Added OpenDR citation

* Update README.md

* Fixes bibtex name (#241)

Fixes citation name

* Fix clang (#250)

* Integration of heart anomaly detection self-attention neural bag of features  (#246)

* added sanbof models

* added attention models to ci test

Co-authored-by: ad-daniel <44834743+ad-daniel@users.noreply.github.com>

* Make `test release` docker target the specific branch when the label is run manually (#252)

* Fix

* Better approach

* Fix

* Update CODEOWNERS (#253)

* Update face-recognition.md (#257)

* skeleton-based HAR demo bug fixed (#260)

* infer updated

* edge case fix (no pose detected)

* pep fixes

* Fix sources after cppcheck upgrade

* More

Co-authored-by: Negar <negar.heidari@eng.au.dk>
Co-authored-by: Nikolaos Passalis <passalis@users.noreply.github.com>
Co-authored-by: ad-daniel <daniel.dias@epfl.ch>

* Update seq2seq_nms_learner.py

* Update seq2seq_nms_learner.py

* add init

Co-authored-by: Nikolaos Passalis <passalis@users.noreply.github.com>
Co-authored-by: Kateryna Chumachenko <katerynaCh@users.noreply.github.com>
Co-authored-by: Stefania Pedrazzi <stefaniapedrazzi@users.noreply.github.com>
Co-authored-by: Pavlos Tosidis <35866477+Pavlos-Tosidis@users.noreply.github.com>
Co-authored-by: Negar Heidari <36771997+negarhdr@users.noreply.github.com>
Co-authored-by: Negar <negar.heidari@eng.au.dk>
Co-authored-by: charsyme <63857415+charsyme@users.noreply.github.com>
Co-authored-by: charsyme <charsyme@csd.auth.gr>
  • Loading branch information
9 people authored Jun 9, 2022
1 parent f3caf87 commit d3beb3b
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 24 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/tests_suite_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
- perception/object_tracking_2d
- perception/object_detection_3d
- perception/pose_estimation
- perception/fall_detection
- perception/speech_recognition
- perception/skeleton_based_action_recognition
- perception/semantic_segmentation
Expand Down Expand Up @@ -150,9 +151,6 @@ jobs:
with:
submodules: true
ref: develop
- name: Build image
run: |
docker build --tag opendr/opendr-toolkit:cpu_test --file Dockerfile .
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5.1
Expand Down Expand Up @@ -182,6 +180,7 @@ jobs:
- perception/multimodal_human_centric
- perception/object_tracking_2d
- perception/pose_estimation
- perception/fall_detection
- perception/speech_recognition
- perception/skeleton_based_action_recognition
- perception/semantic_segmentation
Expand Down Expand Up @@ -253,6 +252,7 @@ jobs:
- perception/multimodal_human_centric
- perception/object_tracking_2d
- perception/pose_estimation
- perception/fall_detection
- perception/speech_recognition
- perception/skeleton_based_action_recognition
- perception/semantic_segmentation
Expand Down Expand Up @@ -330,6 +330,7 @@ jobs:
- perception/multimodal_human_centric
- perception/object_tracking_2d
- perception/pose_estimation
- perception/fall_detection
- perception/speech_recognition
- perception/skeleton_based_action_recognition
- perception/semantic_segmentation
Expand Down Expand Up @@ -372,7 +373,7 @@ jobs:
with:
name: docker-artifact
delete-wheel-artifacts:
needs: [build-wheel, test-wheel]
needs: [build-wheel, test-wheel, test-wheel-separate]
if: ${{ always() }}
strategy:
matrix:
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile-cuda
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ARG branch
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu$(cat /etc/os-release | grep VERSION_ID | awk '{print substr($0,13,5)}' | awk -F'.' '{print $1$2}')/x86_64/3bf863cc.pub

ARG branch

# Install dependencies
RUN apt-get update && \
apt-get --yes install git sudo apt-utils
Expand Down
1 change: 1 addition & 0 deletions docs/reference/face-recognition.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ recognizer.save('./temp/saved_models')
* **Inference example - backbone_only mode**
```python
from opendr.perception.face_recognition import FaceRecognitionLearner
from opendr.engine.data import Image
recognizer = FaceRecognitionLearner(backbone='ir_50', mode='backbone_only', device='cuda')
recognizer.load('./temp/saved_models')
recognizer.fit_reference(path='./data/imgs', save_path='./temp/demo')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,11 @@ def draw_preds(frame, preds: Dict):
if counter > 0:
skeleton_seq = pose2numpy(args, counter, poses_list)

prediction = action_classifier.infer(skeleton_seq)
category_labels = preds2label(prediction.confidence)
print(category_labels)
draw_preds(img, category_labels)
prediction = action_classifier.infer(skeleton_seq)
category_labels = preds2label(prediction.confidence)
print(category_labels)
draw_preds(img, category_labels)

# Calculate a running average on FPS
end_time = time.perf_counter()
fps = 1.0 / (end_time - start_time)
Expand Down
24 changes: 12 additions & 12 deletions src/c_api/face_recognition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,20 +289,20 @@ void build_database_face_recognition(const char *database_folder, const char *ou
// Write number of persons
int n = person_names.size();

fout.write((char *)(&n), sizeof(int));
fout.write(static_cast<char *>(&n), sizeof(int));
for (int i = 0; i < n; i++) {
// Write the name of the person (along with its size)
int name_length = person_names[i].size() + 1;
fout.write((char *)(&name_length), sizeof(int));
fout.write(static_cast<char *>(&name_length), sizeof(int));
fout.write(person_names[i].c_str(), name_length);
}

cv::Size s = database_out.size();

fout.write((char *)(&s.height), sizeof(int));
fout.write((char *)(&s.width), sizeof(int));
fout.write((char *)database_out.data, sizeof(float) * s.height * s.width);
fout.write((char *)(&database_ids[0]), sizeof(int) * s.height);
fout.write(static_cast<char *>(&s.height), sizeof(int));
fout.write(static_cast<char *>(&s.width), sizeof(int));
fout.write(static_cast<char *>(database_out.data), sizeof(float) * s.height * s.width);
fout.write(static_cast<char *>(&database_ids[0]), sizeof(int) * s.height);
fout.flush();
fout.close();
}
Expand All @@ -318,14 +318,14 @@ void load_database_face_recognition(const char *database_path, face_recognition_
return;
}
int n;
fin.read((char *)(&n), sizeof(int));
fin.read(static_cast<char *>(&n), sizeof(int));
char **person_names = new char *[n];

for (int i = 0; i < n; i++) {
person_names[i] = new char[512];
// Read person name
int name_length;
fin.read((char *)(&name_length), sizeof(int));
fin.read(static_cast<char *>(&name_length), sizeof(int));
if (name_length > 512) {
std::cerr << "Person name exceeds max number of characters (512)" << std::endl;
return;
Expand All @@ -334,13 +334,13 @@ void load_database_face_recognition(const char *database_path, face_recognition_
}

int height, width;
fin.read((char *)(&height), sizeof(int));
fin.read((char *)(&width), sizeof(int));
fin.read(static_cast<char *>(&height), sizeof(int));
fin.read(static_cast<char *>(&width), sizeof(int));

float *database_buff = new float[height * width];
int *features_ids = new int[height];
fin.read((char *)(database_buff), sizeof(float) * height * width);
fin.read((char *)(features_ids), sizeof(int) * height);
fin.read(static_cast<char *>(database_buff), sizeof(float) * height * width);
fin.read(static_cast<char *>(features_ids), sizeof(int) * height);

fin.close();

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,9 @@ def infer(self, skeletonseq_batch):

m = nn.Softmax(dim=0)
softmax_predictions = m(output.data[0])
class_confidence = float(torch.max(softmax_predictions))
class_ind = int(torch.argmax(softmax_predictions))
class_description = self.classes_dict[class_ind]
category = Category(prediction=class_ind, confidence=class_confidence, description=class_description)
category = Category(prediction=class_ind, confidence=softmax_predictions, description=class_description)

return category

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,10 +530,9 @@ def infer(self, SkeletonSeq_batch):

m = nn.Softmax(dim=0)
softmax_predictions = m(output.data[0])
class_confidence = float(torch.max(softmax_predictions))
class_ind = int(torch.argmax(softmax_predictions))
class_description = self.classes_dict[class_ind]
category = Category(prediction=class_ind, confidence=class_confidence, description=class_description)
category = Category(prediction=class_ind, confidence=softmax_predictions, description=class_description)

return category

Expand Down

0 comments on commit d3beb3b

Please sign in to comment.