Visualization and Plotting
Bitbox offers advanced visualization features designed specifically for facial and body analysis. Its plotting module uses Plotly, an open-source visualization library, to create interactive, web-based plots that make data exploration intuitive and flexible.
Currently, Bitbox supports visualizing face rectangles, facial landmarks (both 2D and 3D), head pose, and expressions (both global and localized).
# define input file and output directory
input_file = 'data/elaine.mp4'
output_dir = 'output'
# define a face processor
processor = FP(runtime='bitbox:latest')
# set input and output
processor.io(input_file=input_file, output_dir=output_dir)
# detect faces
rects = processor.detect_faces()
# detect 2D landmarks
lands = processor.detect_landmarks()
# compute global expressions, pose, and 3D canonicalized landmarks
exp_global, pose, lands_can = processor.fit()The visualization output is saved as an HTML/JavaScript file in your specified output directory. To view it, simply open the file in any modern web browser such as Chrome, Edge, or Firefox.
When you open the file, you may notice a short delay before the visualization appears. This is normal—the included JavaScript code generates the video frames dynamically in your browser. Depending on your hardware and browser, it may take a few seconds to fully load. Once loaded, you can freely zoom, pan, and interact with the visualization to explore the data in detail.
# visualize landmarks at random poses
processor.plot(lands, pose=pose)
# visualize landmarks with rectangles overlayed
processor.plot(lands, overlay=[rects], video=True) 
# visualize expressions
processor.plot(exp_global, overlay=[rects, lands], video=True)
