Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
9f9ac34
just a *smol* complete re-write ;)
RedHawk989 Jun 3, 2023
1d8b38a
fix camera flips
RedHawk989 Jun 3, 2023
dcae638
add model
RedHawk989 Jun 3, 2023
dd6b355
fix perf
RedHawk989 Jun 3, 2023
98fe294
fix one euro filter
RedHawk989 Jun 3, 2023
1d18c24
fix filter (again)
RedHawk989 Jun 3, 2023
12f0d9a
fix calibration? ONNX optimization
RedHawk989 Jun 4, 2023
b7109f2
fix config save, fix config load, fix config when check is unchecked
RedHawk989 Jun 4, 2023
4fb7050
cleanup, rename things
RedHawk989 Jun 4, 2023
bf2d1fc
fix osc location prefix, cleanup
RedHawk989 Jun 4, 2023
eaadd07
Update osc.py
RedHawk989 Jun 4, 2023
cbc2dae
fix filter/ model output
RedHawk989 Jun 15, 2023
5b1f040
remove unused dependency
RedHawk989 Jun 15, 2023
b857c03
remove print
RedHawk989 Jun 15, 2023
f20dfc0
update installer
RedHawk989 Jun 15, 2023
918d36a
update onnx depend
RedHawk989 Jun 15, 2023
f7d792c
adjust settings layout, bump ver, add credits
RedHawk989 Jun 17, 2023
3511691
add neutral face calibration, adjust checkbox pos
RedHawk989 Jun 17, 2023
80418dc
bump ver
RedHawk989 Jun 17, 2023
8417325
fix default value
RedHawk989 Jun 17, 2023
931aa19
update defaults for VRCFT
RedHawk989 Jun 17, 2023
e6b1665
Changed to cpu torch by default
Meister1593 Jun 17, 2023
0dca722
Merge pull request #1 from Meister1593/main
RedHawk989 Jun 17, 2023
cdd5290
update .iss
RedHawk989 Jun 17, 2023
72add75
Merge branch 'main' of https://github.com/RedHawk989/ProjectBabble
RedHawk989 Jun 17, 2023
686c6da
Update camera.py
SummerSigh Jun 17, 2023
7593783
just a *smol* complete re-write ;)
RedHawk989 Jun 3, 2023
435be10
fix camera flips
RedHawk989 Jun 3, 2023
907599d
add model
RedHawk989 Jun 3, 2023
945d1c4
fix perf
RedHawk989 Jun 3, 2023
2e4b3a9
fix one euro filter
RedHawk989 Jun 3, 2023
a2b61bb
fix filter (again)
RedHawk989 Jun 3, 2023
92d8c1d
fix calibration? ONNX optimization
RedHawk989 Jun 4, 2023
549d4ec
fix config save, fix config load, fix config when check is unchecked
RedHawk989 Jun 4, 2023
2bb9582
cleanup, rename things
RedHawk989 Jun 4, 2023
3360b5a
fix osc location prefix, cleanup
RedHawk989 Jun 4, 2023
6a29809
Update osc.py
RedHawk989 Jun 4, 2023
6b77b1b
fix filter/ model output
RedHawk989 Jun 15, 2023
f911ec9
remove unused dependency
RedHawk989 Jun 15, 2023
1f37fe1
remove print
RedHawk989 Jun 15, 2023
2075272
update installer
RedHawk989 Jun 15, 2023
eb0078e
update onnx depend
RedHawk989 Jun 15, 2023
6bae8ab
adjust settings layout, bump ver, add credits
RedHawk989 Jun 17, 2023
59b723a
add neutral face calibration, adjust checkbox pos
RedHawk989 Jun 17, 2023
077a65d
bump ver
RedHawk989 Jun 17, 2023
dc485ab
fix default value
RedHawk989 Jun 17, 2023
6539f42
update defaults for VRCFT
RedHawk989 Jun 17, 2023
d8f583e
update .iss
RedHawk989 Jun 17, 2023
20baa9a
Changed to cpu torch by default
Meister1593 Jun 17, 2023
746dade
Update camera.py
SummerSigh Jun 17, 2023
e64b65b
Merge remote-tracking branch 'origin/main'
RedHawk989 Jun 17, 2023
af6a1ad
fix crash when port value is backspaced
RedHawk989 Jun 18, 2023
40025d5
remove print
RedHawk989 Jun 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

*.onnx
**/__pycache__/**
**/*.pyc
*.cfg
*.log
BabbleApp/babble_settings.json
BabbleApp/babble_settings.backup
BabbleApp/build
BabbleApp/dist
/vivetest
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/ProjectBabble.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added BabbleApp/Audio/completed.wav
Binary file not shown.
Binary file added BabbleApp/Audio/start.wav
Binary file not shown.
Binary file added BabbleApp/Images/logo.ico
Binary file not shown.
Binary file added BabbleApp/Models/EFV2300K45E100P2.onnx
Binary file not shown.
24 changes: 24 additions & 0 deletions BabbleApp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ProjectBabble
A Mouth tracking system for VR, 100% Opensource!

Currently the architecture is a modified efficientnetv2-b0 training on blenshapes from ARKit! The model outputs 31 blenshapes of which most cross over with SRanipals blendshapes.

### One thing to note
1. This model is not a 1 to 1 translation to SRanipal blenshapes. While most blendshapes do cross over with SRanipal cheek and tounge movements are limited.

### How to run
Go to the releases tab, download the latest exe. Clone this repo, and then move the calibration file (calib.json) to the same location as the exe. Next get the .onnx model in the repo and move it to the same location as the exe. Run the exe and enjoy!

### PLEASE HIT THE TURN OFF CALIBRATION BUTTON UNTILL FURTHER NOTICE
It ruins the model's quality

### Warranty
Lol

### Credit

Thank you to dfgHiatus#7426 for providing the unity demo as well as the intergrations with other apps!

Thank you to Rames The Generic#3540 who made the dataset, tested and evaluated the performence for the models, and for being awesome!

Copyright (c) 2022 Sameer Suri
130 changes: 130 additions & 0 deletions BabbleApp/algo_settings_widget.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
import PySimpleGUI as sg

from config import BabbleSettingsConfig
from osc import Tab
from queue import Queue
from threading import Event

class AlgoSettingsWidget:
def __init__(self, widget_id: Tab, main_config: BabbleSettingsConfig, osc_queue: Queue):


self.gui_general_settings_layout = f"-GENERALSETTINGSLAYOUT{widget_id}-"
self.gui_multiply = f"-MULTIPLY{widget_id}-"
self.gui_model_file = f"-MODLEFILE{widget_id}-"
self.gui_use_gpu = f"USEGPU{widget_id}"
self.gui_speed_coefficient = f"-SPEEDCOEFFICIENT{widget_id}-"
self.gui_min_cutoff = f"-MINCUTOFF{widget_id}-"
self.main_config = main_config
self.config = main_config.settings
self.osc_queue = osc_queue

# Define the window's contents
self.general_settings_layout = [

[sg.Text("Model file:", background_color='#424042'),
sg.InputText(
self.config.gui_model_file,
key=self.gui_model_file,
size=(32),
tooltip="Name of the model file.",
),
],
[sg.Checkbox(
"Use GPU (DirectML)",
default=self.config.gui_use_gpu,
key=self.gui_use_gpu,
background_color='#424042',
tooltip="Toggle GPU execution.",
),
],
[sg.Text("Model output multiplier:", background_color='#424042'),
sg.InputText(
self.config.gui_multiply,
key=self.gui_multiply,
size=(4),
tooltip = "Model output modifier.",
),
],
[
sg.Text("One Euro Filter Paramaters:", background_color='#242224'),
],
[

sg.Text("Min Frequency Cutoff", background_color='#424042'),
sg.InputText(
self.config.gui_min_cutoff,
key=self.gui_min_cutoff,
size=(7),
),
# ],
# [
sg.Text("Speed Coefficient", background_color='#424042'),
sg.InputText(
self.config.gui_speed_coefficient,
key=self.gui_speed_coefficient,
size=(5),
),
],


]


self.widget_layout = [
[
sg.Text("Model Settings:", background_color='#242224'),
],
[
sg.Column(self.general_settings_layout, key=self.gui_general_settings_layout, background_color='#424042' ),
],
]

self.cancellation_event = Event() # Set the event until start is called, otherwise we can block if shutdown is called.
self.cancellation_event.set()
self.image_queue = Queue()


def started(self):
return not self.cancellation_event.is_set()

def start(self):
# If we're already running, bail
if not self.cancellation_event.is_set():
return
self.cancellation_event.clear()

def stop(self):
# If we're not running yet, bail
if self.cancellation_event.is_set():
return
self.cancellation_event.set()

def render(self, window, event, values):
# If anything has changed in our configuration settings, change/update those.
changed = False

if self.config.gui_multiply != int(values[self.gui_multiply]):
self.config.gui_multiply = int(values[self.gui_multiply])
changed = True

if self.config.gui_model_file != values[self.gui_model_file]:
self.config.gui_model_file = values[self.gui_model_file]
changed = True

if self.config.gui_use_gpu != values[self.gui_use_gpu]:
self.config.gui_use_gpu = values[self.gui_use_gpu]
changed = True

if self.config.gui_min_cutoff != values[self.gui_min_cutoff]:
self.config.gui_min_cutoff = values[self.gui_min_cutoff]
changed = True

if self.config.gui_speed_coefficient != values[self.gui_speed_coefficient]:
self.config.gui_speed_coefficient = values[self.gui_speed_coefficient]
changed = True

if changed:
self.main_config.save()
#print(self.main_config)
self.osc_queue.put(Tab.ALGOSETTINGS)
37 changes: 37 additions & 0 deletions BabbleApp/babble_model_loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import json
os.environ["OMP_NUM_THREADS"] = "1"
import onnxruntime as ort
import time
import PySimpleGUI as sg
import cv2
import numpy as np
from pythonosc import udp_client
from torchvision.transforms.functional import to_grayscale
import PIL.Image as Image
from torchvision import transforms
from threading import Thread
from one_euro_filter import OneEuroFilter

def run_model(self):

frame = cv2.resize(self.current_image_gray, (256, 256))
# make it pil
frame = Image.fromarray(frame)
# make it grayscale
frame = to_grayscale(frame)
# make it a tensor
frame = transforms.ToTensor()(frame)
# make it a batch
frame = frame.unsqueeze(0)
# make it a numpy array
frame = frame.numpy()

out = self.sess.run([self.output_name], {self.input_name: frame})
#end = time.time()
output = out[0]
output = output[0]
output = self.one_euro_filter(output)
for i in range(len(output)): # Clip values between 0 - 1
output[i] = max(min(output[i], 1), 0)
self.output = output
Loading