Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

Computer Pointer Controller

This program looks to perform inference on video to understand where a person is looking, and using this to control the computer's mouse pointer. In particular, using OpenVINO technologies to best optimize the models used, allowing for realtime machine learning inference. Below details the underlying archtechture, logic, how to demo the application, and the conclusions reached from testing.

Prerequisite/Installation

The program requires OpenVINO to perform the majority of the tasks. Find the installation guide for Intel® Distribution of OpenVINO™ toolkit:

After installing OpenVINO toolkit, following commands: 1. Initial Setup

git clone https://github.com/Zainrax/Computer-Controller-Pointer-OpenVINO.git
cd Computer-Controller-Pointer-OpenVINO
source /opt/intel/openvino/bin/setupvars.sh -pyver 3.5
pip install -r requirements.txt

2. Model DownloadNote: this downloads all precisions, use --precisions flag to specify precision type. More details found here.

python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "face-detection-adas-binary-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "head-pose-estimation-adas-0001"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "landmarks-regression-retail-0009"
python /opt/intel/openvino/deployment_tools/tools/model_downloader/downloader.py --name "gaze-estimation-adas-0002"

Usage/Demo

Once you have the models downloaded and prerequisites installed, we can run the program:

cd src/
python main.py -i <mp4 video file path/"cam"> \
-fd <path to .xml face decetection model > \
-fl <path to .xml landmarks model > \
-g <path to .xml gaze estimation model> \
-p <path to .xml head pose estimation model>

Inference

Documentation

File Structure

All python files can be found in src/ including

Arguments Available

 -h, --help show this help message and exit
-fd FACE_DETECTION, --face_detection FACE_DETECTION
Path to an xml file for the face detection model.
-fl FACE_LANDMARK, --face_landmark FACE_LANDMARK
Path to an xml file for the face landmark model.
-g GAZE_DETECTION, --gaze_detection GAZE_DETECTION
Path to an xml file for the gaze estimation model.
-p POSE_DETECTION, --pose_detection POSE_DETECTION
Path to an xml file face pose detection model.
-i INPUT, --input INPUT
Path to video file, or cam for Web Cam Usage.
-pt PROB_THRESHOLD, --prob_threshold PROB_THRESHOLD
Probability threshold for detections filtering(0.5 by
default)
-l CPU_EXTENSION, --cpu_extension CPU_EXTENSION
MKLDNN (CPU)-targeted custom layers.Absolute path to a
shared library with thekernels impl.
-d DEVICE, --device DEVICE
Specify the target device to infer on: CPU, GPU, FPGA
or MYRIAD is acceptable. Sample will look for a
suitable plugin for device specified (CPU by default)
-v, --visual Enable visualization on the intermediate models
-nm, --no_move Disables the movement of the mouse

Software Architecture

Architecture

Logic Diagram

Logic_Diagram

Benchmarks

cProfile was the main tool in profiling inference times of all OpenVIO models. Results of the recommended usage can found in main.prof, which can be visualized using SnakeViz to better understand the results. Below is the Inference Times of each model using different precisions available to each model Note: not all models had the same precisions, only bin size is considered, and inference time is calculated based on the average of cumulitive time ub subroutines for the predict funcion

Face Detection

PrecisionInference TimeSize
FP32-INT10.0095451.8MB

Landmarks

PrecisionInference TimeSize
FP320.00068817.6MB
FP160.00068233.8MB
FP16-INT80.00068112.1MB

Head Pose

PrecisionInference TimeSize
FP320.0013177.5MB
FP160.0013613.8MB
FP16-INT80.0011772.1MB

Gaze Estimation

PrecisionInference TimeSize
FP320.001501762KB
FP160.001501381KB
FP16-INT80.001175245KB

Results

The benchmark shows the precision does have some trade-offs between precision, time, and size. The results however can not tell us the exact accuracy lose, but there were no noticeable anomilies in interchanging the precision. Based on the results, the differeence between our FP32 and FP16 inference time gives us no sigificant improvement with the higher precision, and the FP16 would be preferred in this regard due the size halving in all cases. The difference between out INT8 and FP16, though we get some inference time improvements the size difference in significantly less. While I can not comment on the exact accuracy, lowering the percision tends to have an impact on the overall output. Thus it's important to consider it on a case by case bases, where it may be preferred when you have size restrictions.

Handling Edge Cases

The models rely on several inputs from previous inferences or images. It was thus important to have some checking of input validaty, and to see if we could create a robust system that could handle anomalies. In most cases if the model was unable to find the proper output we would move on to the next frame. This prevents inference on bad inputs, but does not make the system robust. In the case of the Landmarks model, even if there were not certain facial features available it would still give us some output. In our case we relied on the eyes, but there will be occurances that we either have no eyes, or one eye. In the case of no eyes we simply have to move to the next frame, but in the case of one eye, we can safely copy the other eye to predict the gaze. Of course this is not perfect (in case of crossed eyed, or other outliers) but it adds the layer of robustness we seek.

About

Several OpenVINO models to manipulate the pointer based on the video input's face.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages