Commit 1652a099 authored by uoega's avatar uoega
Browse files

gitignore update

parent 16e4d457
# files to ignore
# syntax for files
schedule - Kopie.xlsx
# syntax for repositories
Neuer Ordner/
# syntax files types
*.mp4
env/
# Jonas
# general
.vscode/
Synse_Code/
.ipynb_checkpoints/
......@@ -18,7 +10,7 @@ Synse_Code/
# BERT
Bert_language_embeddings/.vscode/
Bert_language_embeddings/env/
Bert_language_embeddings/models/
# LearningToCompare
......@@ -46,17 +38,11 @@ st-gcn_original/net/utils/__pycache__/
st-gcn_original/processor/__pycache__/
st-gcn_original/tools/__pycache__/
st-gcn_original/work_dir/
# st-gcn_original/feature_output/
.nfs000000000ca61cb10000019f
# Hannes
fastText/
# David
sent2vec
fastText/
sent2vec/
st-gcn_original/data
#siamese-triplet/
#siamese-triplet_original/
data/
#superduper kommentar ist super
\ No newline at end of file
This diff is collapsed.
from transformers import AutoTokenizer, AutoModel
import torch
import scipy.io as sio
#Mean Pooling - Take attention mask into account for correct averaging
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0] #First element of model_output contains all token embeddings
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
sum_embeddings = torch.sum(token_embeddings * input_mask_expanded, 1)
sum_mask = torch.clamp(input_mask_expanded.sum(1), min=1e-9)
return sum_embeddings / sum_mask
#Sentences we want sentence embeddings for
sentences = ['drink water',
'eat meal/snack',
'brushing teeth',
'brushing hair',
'drop',
'pickup',
'throw',
'sitting down',
'standing up (from sitting position)',
'clapping',
'reading',
'writing',
'tear up paper',
'wear jacket',
'take off jacket',
'wear a shoe',
'take off a shoe',
'wear on glasses',
'take off glasses',
'put on a hat/cap',
'take off a hat/cap',
'cheer up',
'hand waving',
'kicking something',
'reach into pocket',
'hopping (one foot jumping)',
'jump up',
'make a phone call/answer phone',
'playing with phone/tablet',
'typing on a keyboard',
'pointing to something with finger',
'taking a selfie',
'check time (from watch)',
'rub two hands together',
'nod head/bow',
'shake head',
'wipe face',
'salute',
'put the palms together',
'cross hands in front (say stop)',
'sneeze/cough',
'staggering',
'falling',
'touch head (headache)',
'touch chest (stomachache/heart pain)',
'touch back (backache)',
'touch neck (neckache)',
'nausea or vomiting condition',
'use a fan (with hand or paper)/feeling warm',
'punching/slapping other person',
'kicking other person',
'pushing other person',
'pat on back of other person',
'point finger at the other person',
'hugging other person',
'giving something to other person',
"touch other person's pocket",
'handshaking',
'walking towards each other',
'walking apart from each other']
#LIST above not used!
#read labels from txt file:
label_list = []
class_label_file = open('120_class_label.txt','r')
for lines in class_label_file:
#label = class_label_file.readline()
#print("Zeile" , lines, ": ")
#print(label)
label_list.append(lines)
#Load AutoModel from huggingface model repository
tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/bert-base-nli-mean-tokens")
model = AutoModel.from_pretrained("sentence-transformers/bert-base-nli-mean-tokens")
#Tokenize sentences
encoded_input = tokenizer(label_list, padding=True, truncation=True, max_length=128, return_tensors='pt')
#Compute token embeddings
with torch.no_grad():
model_output = model(**encoded_input)
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
print(sentence_embeddings.shape)
sentence_embeddings = sentence_embeddings.numpy()
print(sentence_embeddings.shape)
sio.savemat('120_class_label_mean.mat', {'attributes':sentence_embeddings})
#Perform pooling. In this case, mean pooling
#from transformers import AutoTokenizer, AutoModel
#import numpy as np
#tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
#model = AutoModel.from_pretrained("bert-base-uncased")
#inputs = tokenizer("drink water", return_tensors="pt")
#outputs = model(**inputs)
##outputs = outputs.last_hidden_state.data.numpy()
#outputs = outputs.pooler_output.data.numpy()
##outputs = outputs.data
##array= outputs.numpy()
#print(outputs)
\ No newline at end of file
Someone shoots something by swing their arm over their headaches
Someone resides down from a attending position
Someone organization up from a participating position
Someone claps their hands in front of their chest
Someone cheers by overcoming both fists up and down above mentioned their warheads
Someone waves their hand abovementioned their headaches
Someone kicks thing by quick moving one leg forward subsequently backward
Someone jumps in placements on one leg with the other leg bent at the knee
Someone climbs up off both legs
Someone endpoints at anything by straddling out their arm in front of their institutions
Someone rubs the palmas of their hands together in front of their chest
Someone bows down with their upper institutions with their armaments still along their sidelines
Someone shakes their warheads from side to disregarded
Someone documents a military salute by behaving one hand to the sidelines of their warheads
Someone document a pray gesture by integrating their palmas together in front of their chest
Someone lifting and surpasses their armaments in front of their chest
Someone orchestrates their hand in front of their mouth to sneeze
Soneone contributes fanning themselves by waving their hand towards their face
Someone lifts an arm and requirements at another personalities
Someone matters their lips with a finger
Someone advocates their hand throughout their hair
Someone delivers a thumbs up by eliminating their fist in front of their chest
Someone deliver a thumbs down by withdrawing thir fist in front of their chest
Someone makes a OK hand gesture by liberalising their hand in front of their chest
Someone makes a victory hand gesture by weightlifting their hand in front of their chest
Someone snapshot their fingernails by eliminating their fist in front of their chest
Someone crouches down from a stay post
Someone destabilises their fist backwards and forth in front of their chest
Someone document a hands up gesture by liberalising their hands up beside their headaches
Someone progresses their armaments on their chest
Someone swings both arms in circles beside their institutions
Someone swings both armaments outward and inward horizontally in front of their chest
Someone information running in workplaces and swinging their arms backwards and forth
Someone is weightlifting their legs backwards
Someone binds down with their upper institutions straddling their arsenals straight down to touch their toes
Someone elevators one straight leg sideways
Someone yawns by withdrawing their flat hand in front of their mouth
Someone interconnects themselves by eliminating both hands above their warheads
Someone does a high five by withdrawing one hand above their headaches and actuallymaking anyone elsewhere ' s hand
Someone drinkers from a glass by improving their hand to their mouth and tilting their headaches backwards
Someone shoots something by swing their arm over their warheads
Someone resides down from a standing positioning
Someone stands up from a awaiting stance
Someone claps their hands in front of their chest
Someone cheering by moving both fists up and down abovementioned their headaches
Someone waves their hand abovementioned their headaches
Someone kicks something by expeditiously progressing one leg ahead then backward
Someone jumps in placements on one leg with the other leg bent at the knee
Someone climbs up off both legs
Someone photopoints at thing by straddling out their arm in front of their institutions
Someone rubs the palmas of their hands together in front of their chest
Someone bows down with their upper institutions with their armaments still along their hillsides
Someone rattles their warheads from side to side
Someone documents a military salute by mainstreaming one hand to the sidelines of their headaches
Someone documents a pray gesture by rejoining their palmas together in front of their chest
Someone lifting and surpasses their armaments in front of their chest
Someone reservations their hand in front of their mouth to sneeze
Soneone encompasses fanning themselves by waving their hand towards their face
Someone eliminates an arm and points at another personalities
Someone hurts their lips with a finger
Someone deprives their hand throughout their hair
Someone delivers a thumbs up by removing their fist in front of their chest
Someone testifies a thumbs down by liberalizing thir fist in front of their chest
Someone makes a OK hand gesture by weightlifting their hand in front of their chest
Someone makes a victory hand gesture by weightlifting their hand in front of their chest
Someone snapshot their fingerprints by removing their fist in front of their chest
Someone crouches down from a station stance
Someone rattles their fist backwards and forth in front of their chest
Someone documents a acknowledges up gesture by weightlifting their hands up besides their headaches
Someone progresses their arsenals on their chest
Someone swings both armaments in circles beside their body
Someone swings both armaments outward and inward horizontally in front of their chest
Someone evaluates running in placements and swinging their arms backwards and forth
Someone enables lifting their legs backwards
Someone binds down with their upper institutions straddling their arms straight down to reaches their toes
Someone withdraws one straight leg sideways
Someone yawns by liberalizing their flat hand in front of their mouth
Someone connects themselves by lifting both hands above mentioned their warheads
Someone does a high five by weightlifting one hand above their warheads and incorporating somebody elsewhere ' s hand
Someone drinkers from a glass by serving their hand to their mouth and tilting their headaches backwards
throw
sitting down
standing up (from sitting position)
clapping
cheer up
hand waving
kicking something
hopping (one foot jumping)
jump up
pointing to something with finger
rub two hands together
nod head/bow
shake head
salute
put the palms together
cross hands in front (say stop)
sneeze/cough
use a fan (with hand or paper)/feeling warm
point finger at the other person
hush (quite)
flick hair
thumb up
thumb down
make ok sign
make victory sign
snapping fingers
squat down
shake fist
hands up (both hands)
cross arms
arm circles
arm swings
running on the spot
butt kicks (kick backward)
cross toe touch
side kick
yawn
stretch oneself
high-five
cheers and drink
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment