This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 127
Support super resolution models and benchmarking #291
Open
Tixxx
wants to merge
7
commits into
master
Choose a base branch
from
tix/depth_to_space
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
99f24c0
6d tensor support in coord lib
7298e79
added tests for 6d and depthtospace
d86cdef
added benchmark tool for onnxjs
b6a6b30
added benchmark build folders to gitignore
347dbdf
minor comments
d2dc883
fixed depth to space test failure
4c5d979
fixed correctness for both depthToSpace and new packed matmul
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Licenses | ||
|
||
TensorFlow.js: | ||
https://github.com/tensorflow/tfjs/blob/master/LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Benchmarks | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we generalize this sub project to other models besides SR, which would be very useful feature? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes i put a TODO in the main index.js file to improve this benchmark to take arbitrary models and configs. For that, we would need a benchmark driver similar to our test-runner-cli. I will do a followup change just for the benchmarking tool. |
||
This sub project is to benchmark model zoo's super resolution model and compare ONNX.js peformance vs other leading in-browser AI Inference frameworks. | ||
|
||
## Frameworks | ||
- TensorFlow.js | ||
- ONNX.js | ||
|
||
## Backends | ||
- WebGL | ||
|
||
## Browsers | ||
(not all framework/backend combinations are supported by all browsers) | ||
- Chrome (WebGL 2) | ||
- Edge (WebGL 1) | ||
|
||
## Instructions | ||
|
||
1. Ensure that the ONNX.js project (the parent) is already installed and built: | ||
```bash | ||
npm ci | ||
npm run build | ||
``` | ||
2. Change to `benchmark/super_resolution_model_zoo` subfolder and run npm ci and build in the benchmark folder | ||
```bash | ||
cd benchmark | ||
npm install | ||
npm run build | ||
``` | ||
3. Run tests (Chrome) | ||
```bash | ||
npm run test | ||
``` | ||
|
||
The test command supports enabling pack mode through environment variables, use: | ||
```bash | ||
PACK=1 npm run test | ||
``` | ||
to enable webGL texture packing for onnxjs and tfjs. |
Binary file added
BIN
+234 KB
benchmark/super_resolution_model_zoo/data/model-onnx/super_resolution.onnx
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Karma configuration | ||
const path = require('path') | ||
function getMachineIpAddress() { | ||
var os = require('os'); | ||
var ifaces = os.networkInterfaces(); | ||
|
||
for (const ifname in ifaces) { | ||
for (const iface of ifaces[ifname]) { | ||
if ('IPv4' !== iface.family || iface.internal !== false) { | ||
// skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses | ||
continue; | ||
} | ||
|
||
// returns the first available IP address | ||
return iface.address; | ||
} | ||
} | ||
|
||
// if no available IP address, fallback to "localhost". | ||
return 'localhost'; | ||
} | ||
|
||
module.exports = function(config) { | ||
config.set({ | ||
basePath: './', | ||
frameworks: ['mocha'], | ||
files: [ | ||
{ pattern: 'dist/main.js' }, | ||
{ pattern: 'dist/onnx-wasm.wasm', included: false}, | ||
{ pattern: 'dist/onnx-worker.js', included: false}, | ||
{ pattern: 'data/**/*', watched: false, included: false, served: true, nocache: true } | ||
], | ||
proxies: { | ||
'/onnx-wasm.wasm': '/base/dist/onnx-wasm.wasm', | ||
'/onnx-worker.js': '/base/dist/onnx-worker.js', | ||
}, | ||
exclude: [ | ||
], | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
}, | ||
reporters: ['mocha'], | ||
captureTimeout: 120000, | ||
reportSlowerThan: 100, | ||
browserDisconnectTimeout: 600000, | ||
browserNoActivityTimeout: 300000, | ||
browserDisconnectTolerance: 0, | ||
browserSocketTimeout: 60000, | ||
logLevel: config.LOG_VERBOSE, | ||
hostname: getMachineIpAddress(), | ||
customLaunchers: { | ||
ChromeTest: {base: 'Chrome', flags: ['--window-size=1,1']}, | ||
ChromeDebug: {debug: true, base: 'Chrome', flags: ['--remote-debugging-port=9333']} | ||
}, | ||
client: { | ||
captureConsole: true, | ||
mocha: {expose: ['body'], timeout: 3000000}, | ||
browser: config.browsers, | ||
printMatches: false, | ||
// To enable pack, run 'PACK=1 npm run test' | ||
usePackedGlTexture: config.usePackedGlTexture==1 ? true : false, | ||
runIteration: config.runIteration ? config.runIteration : 10, | ||
profile: config.profile | ||
}, | ||
browsers: ['ChromeTest', 'ChromeDebug', 'Edge', 'Safari'], | ||
browserConsoleLogOptions: {level: "debug", format: "%b %T: %m", terminal: true}, | ||
}) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be license or readme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we put tfjs in our benchmark, we need to specify tfjs's license here to state that we are using some other project. I think i included a README in the same folder.