Skip to content

Instantly share code, notes, and snippets.

View jcheong0428's full-sized avatar
🥕

Jin Hyun Cheong jcheong0428

🥕
View GitHub Profile
def show_local_mp4_video(file_name, width=640, height=480):
import io
import base64
from IPython.display import HTML
video_encoded = base64.b64encode(io.open(file_name, 'rb').read())
return HTML(data='''<video width="{0}" height="{1}" alt="test" controls>
<source src="data:video/mp4;base64,{2}" type="video/mp4" />
</video>'''.format(width, height, video_encoded.decode('ascii')))
show_local_mp4_video('output.mp4', width=960, height=720)
# clear any previous outputs.
!rm -rf processed
# detect poses on the these 10 seconds.
!./OpenFace/build/bin/FaceLandmarkVidMulti -f video.mp4 -out_dir processed
# convert the result into MP4
!ffmpeg -y -loglevel info -i processed/video.avi output.mp4
!rm -rf youtube.mp4
# download the youtube with the given ID
!youtube-dl -f 'bestvideo[ext=mp4]' --output "youtube.%(ext)s" https://www.youtube.com/watch?v=$YOUTUBE_ID
# cut the first 5 seconds
!ffmpeg -y -loglevel info -i youtube.mp4 -t 10 video.mp4
from IPython.display import YouTubeVideo
# Change the Youtube_ID with the link to your group's video.
YOUTUBE_ID = 'XtA6FQz8BHQ'
YouTubeVideo(YOUTUBE_ID)
import os
from os.path import exists, join, basename, splitext
git_repo_url = 'https://github.com/TadasBaltrusaitis/OpenFace.git'
project_name = splitext(basename(git_repo_url))[0]
# clone openface
!git clone -q --depth 1 $git_repo_url
# install new CMake becaue of CUDA10
!wget -q https://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.tar.gz
@jcheong0428
jcheong0428 / openface_shared.ipynb
Last active March 7, 2024 15:53
OpenFace_Shared.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
m <- lm('Income~Age+Gender',data=data)
summary(m)
contrasts(data$Gender) <- contr.treatment(2)
m <- lm('Income~Age*Gender',data=data)
summary(m)
contrasts(data$Gender) <- c(-.5,.5)
m <- lm('Income~Age*Gender',data=data)
summary(m)
# Run linear model predicting Income from Age, Gender, and their interactions.
m <- lm('Income~Age*Gender',data=data)
summary(m)