Browse Source

Cleanup code

v1
Araragi 2 years ago
parent
commit
72fb86a316
  1. 3
      JKCS-0.6.xpi
  2. 6
      build-chrome.js
  3. 14
      build-ff.js
  4. 8
      chrome/browser-polyfill.min.js
  5. 301
      chrome/dist/main.js
  6. 271
      chrome/dist/model.js
  7. 1
      chrome/dist/test.js
  8. 4
      chrome/dist/weights.js
  9. 7
      chrome/manifest.json
  10. 4
      chrome/options.html
  11. 8
      firefox/browser-polyfill.min.js
  12. 2108
      firefox/dist/background.js
  13. 301
      firefox/dist/main.js
  14. 271
      firefox/dist/model.js
  15. 4
      firefox/dist/weights.js
  16. 7
      firefox/manifest.json
  17. 6
      firefox/options.html
  18. 2
      firefox_update.json
  19. 3
      jkcs-0.15.xpi
  20. 26
      src/charset.json
  21. 22
      src/main.js
  22. 269
      src/model.js
  23. 248
      src/model.json
  24. 4
      src/weights.json

3
JKCS-0.6.xpi

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b7c3ceb25baaeb986017069a8b83a2748ee2e82a336f3a6d84e9259a505a5b3c
size 9513769

6
build-chrome.js

@ -32,7 +32,7 @@ const manif3 = {
host_permissions: ["<all_urls>"],
web_accessible_resources: [
{
resources: ["*.html", "*.js"],
resources: ["*.html", "*.js", "*.json"],
matches: ["<all_urls>"],
},
],
@ -41,7 +41,7 @@ const manif3 = {
matches: domains,
css: [],
run_at: "document_end",
js: ["dist/weights.js", "dist/model.js", "dist/main.js"],
js: ["dist/main.js"],
},
],
};
@ -52,7 +52,7 @@ const manif3 = {
const lmanif = manif3;
res = await esbuild.build({
entryPoints: ["src/weights.js", "src/model.js", "src/main.js"],
entryPoints: ["src/main.js"],
bundle: true,
treeShaking: true,
outdir: "./chrome/dist",

14
build-ff.js

@ -20,7 +20,6 @@ const manif = {
update_url:
"https://git.coom.tech/araragi/JKCS/raw/branch/master/firefox_update.json",
},
},
name: "JannySkillersCaptchaSolver",
description: "The Janny Skillers Captcha Solver of choice.",
@ -34,15 +33,10 @@ const manif = {
matches: domains,
css: [],
run_at: "document_end",
js: [
"polyfill.min.js",
"dist/weights.js",
"dist/model.js",
"dist/main.js",
],
js: ["polyfill.min.js", "dist/main.js"],
},
],
web_accessible_resources: ["*.html", "*.js"],
web_accessible_resources: ["*.html", "*.js", "*.json"],
// "background": {
// persistent: true,
@ -58,7 +52,7 @@ const manif = {
let res;
res = await esbuild.build({
entryPoints: ["src/weights.js", "src/model.js", "src/main.js"],
entryPoints: ["src/main.js"],
bundle: true,
treeShaking: true,
outdir: "./firefox/dist",
@ -113,7 +107,7 @@ const manif = {
res = await webExt.cmd.build({
sourceDir: "./firefox/",
artifactsDir: ".",
filename: "JKCS-firefox.zip",
filename: `JKCS-${manif.version}.xpi`,
overwriteDest: true,
});
console.log(res);

8
chrome/browser-polyfill.min.js

File diff suppressed because one or more lines are too long

301
chrome/dist/main.js

File diff suppressed because one or more lines are too long

271
chrome/dist/model.js

@ -1,271 +0,0 @@
(() => {
// src/model.js
window.modelJSON = {
format: "layers-model",
generatedBy: "keras v2.4.0",
convertedBy: "TensorFlow.js Converter v3.7.0",
modelTopology: {
keras_version: "2.4.0",
backend: "tensorflow",
model_config: {
class_name: "Sequential",
config: {
name: "sequential",
layers: [
{
class_name: "InputLayer",
config: {
batch_input_shape: [null, null, 80, 1],
dtype: "float32",
sparse: false,
ragged: false,
name: "conv2d_input"
}
},
{
class_name: "Conv2D",
config: {
name: "conv2d",
trainable: true,
batch_input_shape: [null, null, 80, 1],
dtype: "float32",
filters: 40,
kernel_size: [3, 3],
strides: [1, 1],
padding: "same",
data_format: "channels_last",
dilation_rate: [1, 1],
groups: 1,
activation: "relu",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
},
{
class_name: "MaxPooling2D",
config: {
name: "max_pooling2d",
trainable: true,
dtype: "float32",
pool_size: [2, 2],
padding: "same",
strides: [2, 2],
data_format: "channels_last"
}
},
{
class_name: "Conv2D",
config: {
name: "conv2d_1",
trainable: true,
dtype: "float32",
filters: 60,
kernel_size: [3, 3],
strides: [1, 1],
padding: "same",
data_format: "channels_last",
dilation_rate: [1, 1],
groups: 1,
activation: "relu",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
},
{
class_name: "MaxPooling2D",
config: {
name: "max_pooling2d_1",
trainable: true,
dtype: "float32",
pool_size: [2, 2],
padding: "same",
strides: [2, 2],
data_format: "channels_last"
}
},
{
class_name: "Reshape",
config: {
name: "reshape",
trainable: true,
dtype: "float32",
target_shape: [-1, 1200]
}
},
{
class_name: "Bidirectional",
config: {
name: "bidi",
trainable: true,
dtype: "float32",
layer: {
class_name: "LSTM",
config: {
name: "lstm",
trainable: true,
dtype: "float32",
return_sequences: true,
return_state: false,
go_backwards: false,
stateful: false,
unroll: false,
time_major: false,
units: 200,
activation: "tanh",
recurrent_activation: "sigmoid",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
recurrent_initializer: {
class_name: "Orthogonal",
config: { gain: 1, seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
unit_forget_bias: true,
kernel_regularizer: null,
recurrent_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
recurrent_constraint: null,
bias_constraint: null,
dropout: 0,
recurrent_dropout: 0,
implementation: 2
}
},
merge_mode: "concat"
}
},
{
class_name: "Dense",
config: {
name: "dense",
trainable: true,
dtype: "float32",
units: 22,
activation: "softmax",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
}
]
}
},
training_config: {
loss: null,
metrics: null,
weighted_metrics: null,
loss_weights: null,
optimizer_config: {
class_name: "RMSprop",
config: {
name: "RMSprop",
learning_rate: 1e-3,
decay: 0,
rho: 0.9,
momentum: 0,
epsilon: 1e-7,
centered: false
}
}
}
},
weightsManifest: [
{
paths: ["group1-shard1of1.bin"],
weights: [
{
name: "bidi/forward_lstm/lstm_cell_4/kernel",
shape: [1200, 800],
dtype: "float32"
},
{
name: "bidi/forward_lstm/lstm_cell_4/recurrent_kernel",
shape: [200, 800],
dtype: "float32"
},
{
name: "bidi/forward_lstm/lstm_cell_4/bias",
shape: [800],
dtype: "float32"
},
{
name: "bidi/backward_lstm/lstm_cell_5/kernel",
shape: [1200, 800],
dtype: "float32"
},
{
name: "bidi/backward_lstm/lstm_cell_5/recurrent_kernel",
shape: [200, 800],
dtype: "float32"
},
{
name: "bidi/backward_lstm/lstm_cell_5/bias",
shape: [800],
dtype: "float32"
},
{ name: "conv2d/kernel", shape: [3, 3, 1, 40], dtype: "float32" },
{ name: "conv2d/bias", shape: [40], dtype: "float32" },
{ name: "conv2d_1/kernel", shape: [3, 3, 40, 60], dtype: "float32" },
{ name: "conv2d_1/bias", shape: [60], dtype: "float32" },
{ name: "dense/kernel", shape: [400, 22], dtype: "float32" },
{ name: "dense/bias", shape: [22], dtype: "float32" }
]
}
]
};
window.charset = [
"",
"0",
"2",
"4",
"8",
"A",
"D",
"G",
"H",
"J",
"K",
"M",
"N",
"P",
"Q",
"R",
"S",
"T",
"V",
"W",
"X",
"Y"
];
})();

1
chrome/dist/test.js

@ -1 +0,0 @@
fetch("https://de.catbox.moe/jpovmr.png");

4
chrome/dist/weights.js

File diff suppressed because one or more lines are too long

7
chrome/manifest.json

@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "JannySkillersCaptchaSolver",
"description": "The Janny Skillers Captcha Solver of choice.",
"version": "0.6",
"version": "0.15",
"icons": {
"64": "1449696017588.png"
},
@ -14,7 +14,8 @@
{
"resources": [
"*.html",
"*.js"
"*.js",
"*.json"
],
"matches": [
"<all_urls>"
@ -30,8 +31,6 @@
"css": [],
"run_at": "document_end",
"js": [
"dist/weights.js",
"dist/model.js",
"dist/main.js"
]
}

4
chrome/options.html

@ -1,4 +0,0 @@
<!DOCTYPE html>
<body>
<script src="./dist/background.js"></script>
</body>

8
firefox/browser-polyfill.min.js

File diff suppressed because one or more lines are too long

2108
firefox/dist/background.js

File diff suppressed because it is too large

301
firefox/dist/main.js

File diff suppressed because one or more lines are too long

271
firefox/dist/model.js

@ -1,271 +0,0 @@
(() => {
// src/model.js
window.modelJSON = {
format: "layers-model",
generatedBy: "keras v2.4.0",
convertedBy: "TensorFlow.js Converter v3.7.0",
modelTopology: {
keras_version: "2.4.0",
backend: "tensorflow",
model_config: {
class_name: "Sequential",
config: {
name: "sequential",
layers: [
{
class_name: "InputLayer",
config: {
batch_input_shape: [null, null, 80, 1],
dtype: "float32",
sparse: false,
ragged: false,
name: "conv2d_input"
}
},
{
class_name: "Conv2D",
config: {
name: "conv2d",
trainable: true,
batch_input_shape: [null, null, 80, 1],
dtype: "float32",
filters: 40,
kernel_size: [3, 3],
strides: [1, 1],
padding: "same",
data_format: "channels_last",
dilation_rate: [1, 1],
groups: 1,
activation: "relu",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
},
{
class_name: "MaxPooling2D",
config: {
name: "max_pooling2d",
trainable: true,
dtype: "float32",
pool_size: [2, 2],
padding: "same",
strides: [2, 2],
data_format: "channels_last"
}
},
{
class_name: "Conv2D",
config: {
name: "conv2d_1",
trainable: true,
dtype: "float32",
filters: 60,
kernel_size: [3, 3],
strides: [1, 1],
padding: "same",
data_format: "channels_last",
dilation_rate: [1, 1],
groups: 1,
activation: "relu",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
},
{
class_name: "MaxPooling2D",
config: {
name: "max_pooling2d_1",
trainable: true,
dtype: "float32",
pool_size: [2, 2],
padding: "same",
strides: [2, 2],
data_format: "channels_last"
}
},
{
class_name: "Reshape",
config: {
name: "reshape",
trainable: true,
dtype: "float32",
target_shape: [-1, 1200]
}
},
{
class_name: "Bidirectional",
config: {
name: "bidi",
trainable: true,
dtype: "float32",
layer: {
class_name: "LSTM",
config: {
name: "lstm",
trainable: true,
dtype: "float32",
return_sequences: true,
return_state: false,
go_backwards: false,
stateful: false,
unroll: false,
time_major: false,
units: 200,
activation: "tanh",
recurrent_activation: "sigmoid",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
recurrent_initializer: {
class_name: "Orthogonal",
config: { gain: 1, seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
unit_forget_bias: true,
kernel_regularizer: null,
recurrent_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
recurrent_constraint: null,
bias_constraint: null,
dropout: 0,
recurrent_dropout: 0,
implementation: 2
}
},
merge_mode: "concat"
}
},
{
class_name: "Dense",
config: {
name: "dense",
trainable: true,
dtype: "float32",
units: 22,
activation: "softmax",
use_bias: true,
kernel_initializer: {
class_name: "GlorotUniform",
config: { seed: null }
},
bias_initializer: { class_name: "Zeros", config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
}
]
}
},
training_config: {
loss: null,
metrics: null,
weighted_metrics: null,
loss_weights: null,
optimizer_config: {
class_name: "RMSprop",
config: {
name: "RMSprop",
learning_rate: 1e-3,
decay: 0,
rho: 0.9,
momentum: 0,
epsilon: 1e-7,
centered: false
}
}
}
},
weightsManifest: [
{
paths: ["group1-shard1of1.bin"],
weights: [
{
name: "bidi/forward_lstm/lstm_cell_4/kernel",
shape: [1200, 800],
dtype: "float32"
},
{
name: "bidi/forward_lstm/lstm_cell_4/recurrent_kernel",
shape: [200, 800],
dtype: "float32"
},
{
name: "bidi/forward_lstm/lstm_cell_4/bias",
shape: [800],
dtype: "float32"
},
{
name: "bidi/backward_lstm/lstm_cell_5/kernel",
shape: [1200, 800],
dtype: "float32"
},
{
name: "bidi/backward_lstm/lstm_cell_5/recurrent_kernel",
shape: [200, 800],
dtype: "float32"
},
{
name: "bidi/backward_lstm/lstm_cell_5/bias",
shape: [800],
dtype: "float32"
},
{ name: "conv2d/kernel", shape: [3, 3, 1, 40], dtype: "float32" },
{ name: "conv2d/bias", shape: [40], dtype: "float32" },
{ name: "conv2d_1/kernel", shape: [3, 3, 40, 60], dtype: "float32" },
{ name: "conv2d_1/bias", shape: [60], dtype: "float32" },
{ name: "dense/kernel", shape: [400, 22], dtype: "float32" },
{ name: "dense/bias", shape: [22], dtype: "float32" }
]
}
]
};
window.charset = [
"",
"0",
"2",
"4",
"8",
"A",
"D",
"G",
"H",
"J",
"K",
"M",
"N",
"P",
"Q",
"R",
"S",
"T",
"V",
"W",
"X",
"Y"
];
})();

4
firefox/dist/weights.js

File diff suppressed because one or more lines are too long

7
firefox/manifest.json

@ -8,7 +8,7 @@
},
"name": "JannySkillersCaptchaSolver",
"description": "The Janny Skillers Captcha Solver of choice.",
"version": "0.6",
"version": "0.15",
"icons": {
"64": "1449696017588.png"
},
@ -26,14 +26,13 @@
"run_at": "document_end",
"js": [
"polyfill.min.js",
"dist/weights.js",
"dist/model.js",
"dist/main.js"
]
}
],
"web_accessible_resources": [
"*.html",
"*.js"
"*.js",
"*.json"
]
}

6
firefox/options.html

@ -1,6 +0,0 @@
<!DOCTYPE html>
<body>
<script src="./polyfill.min.js"></script>
<script src="./browser-polyfill.min.js"></script>
<script src="./dist/background.js"></script>
</body>

2
firefox_update.json

@ -1 +1 @@
{"addons":{"{4127d5ac-25a0-4453-8d51-bb2eec2ae629}":{"updates":[{"version":"0.6","update_link":"https://git.coom.tech/araragi/JKCS/raw/branch/master/JKCS-0.6.xpi"}]}}}
{"addons":{"{4127d5ac-25a0-4453-8d51-bb2eec2ae629}":{"updates":[{"version":"0.15","update_link":"https://git.coom.tech/araragi/JKCS/raw/branch/master/JKCS-0.15.xpi"}]}}}

3
jkcs-0.15.xpi

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad1767d9be2a7336e9d6f934c5bdb9c228fb677e63db793eb00b13008dfeb957
size 9497124

26
src/charset.json

@ -0,0 +1,26 @@
{
"charset": [
"",
"0",
"2",
"4",
"8",
"A",
"D",
"G",
"H",
"J",
"K",
"M",
"N",
"P",
"Q",
"R",
"S",
"T",
"V",
"W",
"X",
"Y"
]
}

22
src/main.js

@ -1,5 +1,7 @@
// eslint-disable-next-line import/no-unassigned-import
import * as tf from '@tensorflow/tfjs'
import modelJSON from './model.json'
import weightsJSON from './weights.json'
import charsetJSON from './charset.json'
let model
@ -24,12 +26,12 @@ const iohander = {
load: function () {
return new Promise((resolve, reject) => {
resolve({
modelTopology: window.modelJSON.modelTopology,
weightSpecs: window.modelJSON.weightsManifest[0].weights,
weightData: base64ToArray(window.weights64),
format: window.modelJSON.format,
generatedBy: window.modelJSON.generatedBy,
convertedBy: window.modelJSON.convertedBy
modelTopology: modelJSON.modelTopology,
weightSpecs: modelJSON.weightsManifest[0].weights,
weightData: base64ToArray(weightsJSON.weights64),
format: modelJSON.format,
generatedBy: modelJSON.generatedBy,
convertedBy: modelJSON.convertedBy
})
})
}
@ -204,7 +206,7 @@ async function predict (img, bg, off) {
}
function createSequence (prediction) {
const csl = charset.length
const csl = charsetJSON.charset.length
sequence = []
for (let pos = 0; pos < prediction.length; pos += csl) {
@ -215,7 +217,7 @@ function createSequence (prediction) {
for (let i = 0; i < csl; i++) {
const p = preds[i] / max
const c = charset[i + 1]
const c = charsetJSON.charset[i + 1]
if (p >= 0.05) {
seqElem[c || ''] = p
@ -229,7 +231,7 @@ function createSequence (prediction) {
}
function postprocess (sequence, overrides) {
csl = charset.length
csl = charsetJSON.charset.length
possibilities = [{ sequence: [] }]
sequence.forEach(function (e, i) {

269
src/model.js

@ -1,269 +0,0 @@
window.modelJSON = {
format: 'layers-model',
generatedBy: 'keras v2.4.0',
convertedBy: 'TensorFlow.js Converter v3.7.0',
modelTopology: {
keras_version: '2.4.0',
backend: 'tensorflow',
model_config: {
class_name: 'Sequential',
config: {
name: 'sequential',
layers: [
{
class_name: 'InputLayer',
config: {
batch_input_shape: [null, null, 80, 1],
dtype: 'float32',
sparse: false,
ragged: false,
name: 'conv2d_input'
}
},
{
class_name: 'Conv2D',
config: {
name: 'conv2d',
trainable: true,
batch_input_shape: [null, null, 80, 1],
dtype: 'float32',
filters: 40,
kernel_size: [3, 3],
strides: [1, 1],
padding: 'same',
data_format: 'channels_last',
dilation_rate: [1, 1],
groups: 1,
activation: 'relu',
use_bias: true,
kernel_initializer: {
class_name: 'GlorotUniform',
config: { seed: null }
},
bias_initializer: { class_name: 'Zeros', config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
},
{
class_name: 'MaxPooling2D',
config: {
name: 'max_pooling2d',
trainable: true,
dtype: 'float32',
pool_size: [2, 2],
padding: 'same',
strides: [2, 2],
data_format: 'channels_last'
}
},
{
class_name: 'Conv2D',
config: {
name: 'conv2d_1',
trainable: true,
dtype: 'float32',
filters: 60,
kernel_size: [3, 3],
strides: [1, 1],
padding: 'same',
data_format: 'channels_last',
dilation_rate: [1, 1],
groups: 1,
activation: 'relu',
use_bias: true,
kernel_initializer: {
class_name: 'GlorotUniform',
config: { seed: null }
},
bias_initializer: { class_name: 'Zeros', config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
},
{
class_name: 'MaxPooling2D',
config: {
name: 'max_pooling2d_1',
trainable: true,
dtype: 'float32',
pool_size: [2, 2],
padding: 'same',
strides: [2, 2],
data_format: 'channels_last'
}
},
{
class_name: 'Reshape',
config: {
name: 'reshape',
trainable: true,
dtype: 'float32',
target_shape: [-1, 1200]
}
},
{
class_name: 'Bidirectional',
config: {
name: 'bidi',
trainable: true,
dtype: 'float32',
layer: {
class_name: 'LSTM',
config: {
name: 'lstm',
trainable: true,
dtype: 'float32',
return_sequences: true,
return_state: false,
go_backwards: false,
stateful: false,
unroll: false,
time_major: false,
units: 200,
activation: 'tanh',
recurrent_activation: 'sigmoid',
use_bias: true,
kernel_initializer: {
class_name: 'GlorotUniform',
config: { seed: null }
},
recurrent_initializer: {
class_name: 'Orthogonal',
config: { gain: 1.0, seed: null }
},
bias_initializer: { class_name: 'Zeros', config: {} },
unit_forget_bias: true,
kernel_regularizer: null,
recurrent_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
recurrent_constraint: null,
bias_constraint: null,
dropout: 0.0,
recurrent_dropout: 0.0,
implementation: 2
}
},
merge_mode: 'concat'
}
},
{
class_name: 'Dense',
config: {
name: 'dense',
trainable: true,
dtype: 'float32',
units: 22,
activation: 'softmax',
use_bias: true,
kernel_initializer: {
class_name: 'GlorotUniform',
config: { seed: null }
},
bias_initializer: { class_name: 'Zeros', config: {} },
kernel_regularizer: null,
bias_regularizer: null,
activity_regularizer: null,
kernel_constraint: null,
bias_constraint: null
}
}
]
}
},
training_config: {
loss: null,
metrics: null,
weighted_metrics: null,
loss_weights: null,
optimizer_config: {
class_name: 'RMSprop',
config: {
name: 'RMSprop',
learning_rate: 0.001,
decay: 0.0,
rho: 0.9,
momentum: 0.0,
epsilon: 1e-7,
centered: false
}
}
}
},
weightsManifest: [
{
paths: ['group1-shard1of1.bin'],
weights: [
{
name: 'bidi/forward_lstm/lstm_cell_4/kernel',
shape: [1200, 800],
dtype: 'float32'
},
{
name: 'bidi/forward_lstm/lstm_cell_4/recurrent_kernel',
shape: [200, 800],
dtype: 'float32'
},
{
name: 'bidi/forward_lstm/lstm_cell_4/bias',
shape: [800],
dtype: 'float32'
},
{
name: 'bidi/backward_lstm/lstm_cell_5/kernel',
shape: [1200, 800],
dtype: 'float32'
},
{
name: 'bidi/backward_lstm/lstm_cell_5/recurrent_kernel',
shape: [200, 800],
dtype: 'float32'
},
{
name: 'bidi/backward_lstm/lstm_cell_5/bias',
shape: [800],
dtype: 'float32'
},
{ name: 'conv2d/kernel', shape: [3, 3, 1, 40], dtype: 'float32' },
{ name: 'conv2d/bias', shape: [40], dtype: 'float32' },
{ name: 'conv2d_1/kernel', shape: [3, 3, 40, 60], dtype: 'float32' },
{ name: 'conv2d_1/bias', shape: [60], dtype: 'float32' },
{ name: 'dense/kernel', shape: [400, 22], dtype: 'float32' },
{ name: 'dense/bias', shape: [22], dtype: 'float32' }
]
}
]
}
window.charset = [
'',
'0',
'2',
'4',
'8',
'A',
'D',
'G',
'H',
'J',
'K',
'M',
'N',
'P',
'Q',
'R',
'S',
'T',
'V',
'W',
'X',
'Y'
]

248
src/model.json

@ -0,0 +1,248 @@
{
"format": "layers-model",
"generatedBy": "keras v2.4.0",
"convertedBy": "TensorFlow.js Converter v3.7.0",
"modelTopology": {
"keras_version": "2.4.0",
"backend": "tensorflow",
"model_config": {
"class_name": "Sequential",
"config": {
"name": "sequential",
"layers": [
{
"class_name": "InputLayer",
"config": {
"batch_input_shape": [null, null, 80, 1],
"dtype": "float32",
"sparse": false,
"ragged": false,
"name": "conv2d_input"
}
},
{
"class_name": "Conv2D",
"config": {
"name": "conv2d",
"trainable": true,
"batch_input_shape": [null, null, 80, 1],
"dtype": "float32",
"filters": 40,
"kernel_size": [3, 3],
"strides": [1, 1],
"padding": "same",
"data_format": "channels_last",
"dilation_rate": [1, 1],
"groups": 1,
"activation": "relu",
"use_bias": true,
"kernel_initializer": {
"class_name": "GlorotUniform",
"config": { "seed": null }
},
"bias_initializer": { "class_name": "Zeros", "config": {} },
"kernel_regularizer": null,
"bias_regularizer": null,
"activity_regularizer": null,
"kernel_constraint": null,
"bias_constraint": null
}
},
{
"class_name": "MaxPooling2D",
"config": {
"name": "max_pooling2d",
"trainable": true,
"dtype": "float32",
"pool_size": [2, 2],
"padding": "same",
"strides": [2, 2],
"data_format": "channels_last"
}
},
{
"class_name": "Conv2D",
"config": {
"name": "conv2d_1",
"trainable": true,
"dtype": "float32",
"filters": 60,
"kernel_size": [3, 3],
"strides": [1, 1],
"padding": "same",
"data_format": "channels_last",
"dilation_rate": [1, 1],
"groups": 1,
"activation": "relu",
"use_bias": true,
"kernel_initializer": {
"class_name": "GlorotUniform",
"config": { "seed": null }
},
"bias_initializer": { "class_name": "Zeros", "config": {} },
"kernel_regularizer": null,
"bias_regularizer": null,
"activity_regularizer": null,
"kernel_constraint": null,
"bias_constraint": null
}
},
{
"class_name": "MaxPooling2D",
"config": {
"name": "max_pooling2d_1",
"trainable": true,
"dtype": "float32",
"pool_size": [2, 2],
"padding": "same",
"strides": [2, 2],
"data_format": "channels_last"
}
},
{
"class_name": "Reshape",
"config": {
"name": "reshape",
"trainable": true,
"dtype": "float32",
"target_shape": [-1, 1200]
}
},
{
"class_name": "Bidirectional",
"config": {
"name": "bidi",
"trainable": true,
"dtype": "float32",
"layer": {
"class_name": "LSTM",
"config": {
"name": "lstm",
"trainable": true,
"dtype": "float32",
"return_sequences": true,
"return_state": false,
"go_backwards": false,
"stateful": false,
"unroll": false,
"time_major": false,
"units": 200,
"activation": "tanh",
"recurrent_activation": "sigmoid",
"use_bias": true,
"kernel_initializer": {
"class_name": "GlorotUniform",
"config": { "seed": null }
},
"recurrent_initializer": {
"class_name": "Orthogonal",
"config": { "gain": 1.0, "seed": null }
},
"bias_initializer": { "class_name": "Zeros", "config": {} },
"unit_forget_bias": true,
"kernel_regularizer": null,
"recurrent_regularizer": null,
"bias_regularizer": null,
"activity_regularizer": null,
"kernel_constraint": null,
"recurrent_constraint": null,
"bias_constraint": null,
"dropout": 0.0,
"recurrent_dropout": 0.0,
"implementation": 2
}
},
"merge_mode": "concat"
}
},
{
"class_name": "Dense",
"config": {
"name": "dense",
"trainable": true,
"dtype": "float32",
"units": 22,
"activation": "softmax",
"use_bias": true,
"kernel_initializer": {
"class_name": "GlorotUniform",
"config": { "seed": null }
},
"bias_initializer": { "class_name": "Zeros", "config": {} },
"kernel_regularizer": null,
"bias_regularizer": null,
"activity_regularizer": null,
"kernel_constraint": null,
"bias_constraint": null
}
}
]
}
},
"training_config": {
"loss": null,
"metrics": null,
"weighted_metrics": null,
"loss_weights": null,
"optimizer_config": {
"class_name": "RMSprop",
"config": {
"name": "RMSprop",
"learning_rate": 0.001,
"decay": 0.0,
"rho": 0.9,
"momentum": 0.0,
"epsilon": 1e-7,
"centered": false
}
}
}
},
"weightsManifest": [
{
"paths": ["group1-shard1of1.bin"],
"weights": [
{
"name": "bidi/forward_lstm/lstm_cell_4/kernel",
"shape": [1200, 800],
"dtype": "float32"
},
{
"name": "bidi/forward_lstm/lstm_cell_4/recurrent_kernel",
"shape": [200, 800],
"dtype": "float32"
},
{
"name": "bidi/forward_lstm/lstm_cell_4/bias",
"shape": [800],
"dtype": "float32"
},
{
"name": "bidi/backward_lstm/lstm_cell_5/kernel",
"shape": [1200, 800],
"dtype": "float32"
},
{
"name": "bidi/backward_lstm/lstm_cell_5/recurrent_kernel",
"shape": [200, 800],
"dtype": "float32"
},
{
"name": "bidi/backward_lstm/lstm_cell_5/bias",
"shape": [800],
"dtype": "float32"
},
{ "name": "conv2d/kernel", "shape": [3, 3, 1, 40], "dtype": "float32" },
{ "name": "conv2d/bias", "shape": [40], "dtype": "float32" },
{
"name": "conv2d_1/kernel",
"shape": [3, 3, 40, 60],
"dtype": "float32"
},
{ "name": "conv2d_1/bias", "shape": [60], "dtype": "float32" },
{ "name": "dense/kernel", "shape": [400, 22], "dtype": "float32" },
{ "name": "dense/bias", "shape": [22], "dtype": "float32" }
]
}
]
}

4
src/weights.js → src/weights.json

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save