未验证 提交 3687a96f 编写于 作者: H haozech 提交者: GitHub

Merge pull request #8 from haozech/develop_chz

compataible with webgl1.0; rewrite sorting algorithm of ops; fix bugs
...@@ -151,8 +151,6 @@ export default class imageFeed { ...@@ -151,8 +151,6 @@ export default class imageFeed {
} }
} }
} }
console.log('this is the end of reshapetorgb !!!');
console.dir(result);
return result; return result;
}; };
...@@ -164,7 +162,6 @@ export default class imageFeed { ...@@ -164,7 +162,6 @@ export default class imageFeed {
* @return {Object} 缩放后的尺寸 * @return {Object} 缩放后的尺寸
*/ */
reSize(image, params) { reSize(image, params) {
console.log('execute resize!!');
// 原始图片宽高 // 原始图片宽高
const width = this.pixelWidth; const width = this.pixelWidth;
const height = this.pixelHeight; const height = this.pixelHeight;
...@@ -192,7 +189,6 @@ export default class imageFeed { ...@@ -192,7 +189,6 @@ export default class imageFeed {
* 根据scale缩放图像并且缩放成目标尺寸并居中 * 根据scale缩放图像并且缩放成目标尺寸并居中
*/ */
resizeAndFitTargetSize(image, params){ resizeAndFitTargetSize(image, params){
console.log('execute resizeAndFitTargetSize!!');
// 原始图片宽高 // 原始图片宽高
const width = this.pixelWidth; const width = this.pixelWidth;
const height = this.pixelHeight; const height = this.pixelHeight;
...@@ -249,7 +245,6 @@ export default class imageFeed { ...@@ -249,7 +245,6 @@ export default class imageFeed {
sh = Math.round(sw * this.pixelHeight / this.pixelWidth); sh = Math.round(sw * this.pixelHeight / this.pixelWidth);
y = Math.floor((targetHeight - sh) / 2); y = Math.floor((targetHeight - sh) / 2);
} }
// console.log(x, y, sw, sh);
if (center) { if (center) {
this.fromPixels2DContext.drawImage( this.fromPixels2DContext.drawImage(
image, x, y, sw, sh); image, x, y, sw, sh);
...@@ -327,24 +322,18 @@ export default class imageFeed { ...@@ -327,24 +322,18 @@ export default class imageFeed {
data = this.resizeAndFitTargetSize(pixels, opt); data = this.resizeAndFitTargetSize(pixels, opt);
data2 = this.fromPixels2DContext2.getImageData(0, 0, this.pixelWidth, this.pixelHeight); data2 = this.fromPixels2DContext2.getImageData(0, 0, this.pixelWidth, this.pixelHeight);
} }
else if (opt.scale) { // 兼容以前的,如果有scale就是短边缩放到scale模式 else if (opt.scale) { // 直接resize到targetShape Humanseg的情况
scaleSize = this.reSize(pixels, opt); scaleSize = this.reSize(pixels, opt);
console.dir(scaleSize);
console.dir(pixels);
data = this.getImageData(opt, 0, 0, scaleSize); data = this.getImageData(opt, 0, 0, scaleSize);
data2 = this.fromPixels2DContext2.getImageData(0, 0, this.pixelWidth, this.pixelHeight); data2 = this.fromPixels2DContext2.getImageData(0, 0, this.pixelWidth, this.pixelHeight);
} }
else if (opt.targetSize) { // 如果有targetSize,就是装在目标宽高里的模式 TinyYolo的情况 else if (opt.targetSize) { // 如果有targetSize,就是装在目标宽高里的模式 TinyYolo的情况
scaleSize = this.fitToTargetSize(pixels, opt); scaleSize = this.fitToTargetSize(pixels, opt);
data = this.getImageData(opt, 0, 0, scaleSize); data = this.getImageData(opt, 0, 0, scaleSize);
data2 = this.fromPixels2DContext2.getImageData(0, 0, this.pixelWidth, this.pixelHeight); data2 = this.fromPixels2DContext2.getImageData(0, 0, this.pixelWidth, this.pixelHeight);
} }
} }
if (opt.gray) { if (opt.gray) {
data = grayscale(data); data = grayscale(data);
} }
...@@ -359,6 +348,7 @@ export default class imageFeed { ...@@ -359,6 +348,7 @@ export default class imageFeed {
else if (opt.targetShape) { else if (opt.targetShape) {
data = this.allReshapeToRGB(data, opt, scaleSize); data = this.allReshapeToRGB(data, opt, scaleSize);
} }
return [{data: data, shape: opt.shape || opt.targetShape, name: 'image', canvas: data2}]; return [{data: data, shape: opt.shape || opt.targetShape, name: 'image', canvas: data2}];
} }
} }
......
...@@ -51,6 +51,10 @@ export default class gpu { ...@@ -51,6 +51,10 @@ export default class gpu {
console.log('float extension is started or not? ' + !!this.textureFloat); console.log('float extension is started or not? ' + !!this.textureFloat);
} }
} }
this.maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
this.maxTextureImageUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);
// 关闭相关功能 // 关闭相关功能
gl.disable(gl.DEPTH_TEST); gl.disable(gl.DEPTH_TEST);
gl.disable(gl.STENCIL_TEST); gl.disable(gl.STENCIL_TEST);
...@@ -67,14 +71,22 @@ export default class gpu { ...@@ -67,14 +71,22 @@ export default class gpu {
this.waits = 0; this.waits = 0;
console.log('WebGl版本是 ' + this.version); console.log('WebGl版本是 ' + this.version);
console.log('MAX_TEXTURE_SIZE is ' + gl.getParameter(gl.MAX_TEXTURE_SIZE)); console.log('MAX_TEXTURE_SIZE is ' + this.maxTextureSize);
console.log('MAX_TEXTURE_IMAGE_UNITS is ' + gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)); console.log('MAX_TEXTURE_IMAGE_UNITS is ' + this.maxTextureImageUnits);
} }
getWebglVersion() { getWebglVersion() {
return this.version; return this.version;
} }
getWebglMaxTextureSize() {
return this.maxTextureSize;
}
getWebglMaxTextureImageUnits() {
return this.maxTextureImageUnits;
}
initCache() { initCache() {
// 运行次数 // 运行次数
this.times = 0; this.times = 0;
...@@ -145,7 +157,6 @@ export default class gpu { ...@@ -145,7 +157,6 @@ export default class gpu {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texImage2D(gl.TEXTURE_2D, // Target, matches bind above. gl.texImage2D(gl.TEXTURE_2D, // Target, matches bind above.
0, // Level of detail. 0, // Level of detail.
this.downloadInternalFormat, // Internal format. this.downloadInternalFormat, // Internal format.
...@@ -346,6 +357,7 @@ export default class gpu { ...@@ -346,6 +357,7 @@ export default class gpu {
} else { } else {
// texture = gl.createTexture(); // texture = gl.createTexture();
if (isRendered && (iLayer > 0 || (iLayer === 0 && item.tensor !== 'origin'))) { if (isRendered && (iLayer > 0 || (iLayer === 0 && item.tensor !== 'origin'))) {
const tData = this.cacheTextures['' + iLayer]; const tData = this.cacheTextures['' + iLayer];
texture = tData[item.variable + '_' + item.tensor]; texture = tData[item.variable + '_' + item.tensor];
} else { } else {
...@@ -361,6 +373,7 @@ export default class gpu { ...@@ -361,6 +373,7 @@ export default class gpu {
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
if (this.version == 2){
gl.texImage2D(gl.TEXTURE_2D, gl.texImage2D(gl.TEXTURE_2D,
0, 0,
this.internalFormat, this.internalFormat,
...@@ -369,8 +382,27 @@ export default class gpu { ...@@ -369,8 +382,27 @@ export default class gpu {
0, 0,
this.textureFormat, this.textureFormat,
gl.FLOAT, gl.FLOAT,
item.data, item.data);
0); }
else {
let oneSize = item.width_texture * item.height_texture;
let temp = new Float32Array(item.width_texture * item.height_texture * 4);
for (let i = 0; i < item.data.length; i++){
temp[i*4] = (item.data[i]);
temp[i*4+1] = 0;
temp[i*4+2] = 0;
temp[i*4+3] = 0;
}
gl.texImage2D(gl.TEXTURE_2D,
0,
gl.RGBA,
item.width_texture,
item.height_texture,
0,
gl.RGBA,
gl.FLOAT,
temp);
}
} }
} }
...@@ -389,7 +421,7 @@ export default class gpu { ...@@ -389,7 +421,7 @@ export default class gpu {
// 生成帧缓存的texture // 生成帧缓存的texture
makeTexure(type, data, opts = {}) { makeTexure(type, data, opts = {}) {
const gl = this.gl; const gl = this.gl;
let index = this.textureBufferIndex % 2; let index = int(mod(float(this.textureBufferIndex), 2.0));
let texture = this.textureBuffer[index]; let texture = this.textureBuffer[index];
gl.bindTexture(gl.TEXTURE_2D, texture); gl.bindTexture(gl.TEXTURE_2D, texture);
...@@ -429,6 +461,7 @@ export default class gpu { ...@@ -429,6 +461,7 @@ export default class gpu {
} }
createPBO() { createPBO() {
if (this.version == 2){
const gl2 = this.gl; const gl2 = this.gl;
const buffer = this.pbo; const buffer = this.pbo;
gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer); gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer);
...@@ -437,42 +470,40 @@ export default class gpu { ...@@ -437,42 +470,40 @@ export default class gpu {
gl2.readPixels(0, 0, this.width_texture_out, this.height_texture_out, gl2.RGBA, gl2.FLOAT, 0); gl2.readPixels(0, 0, this.width_texture_out, this.height_texture_out, gl2.RGBA, gl2.FLOAT, 0);
gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null); gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null);
return buffer; return buffer;
}
else {
let buffer = new Float32Array(this.width_texture_out * this.height_texture_out * 4);
const gl2 = this.gl;
gl2.readPixels(0, 0, this.width_texture_out, this.height_texture_out, gl2.RGBA, gl2.FLOAT, buffer);
return buffer;
}
} }
downloadFoat32TensorFromBuffer(buffer) { downloadFoat32TensorFromBuffer(buffer) {
const gl2 = this.gl; const gl2 = this.gl;
const size = 4 * this.width_texture_out * this.height_texture_out; const size = 4 * this.width_texture_out * this.height_texture_out;
if (this.version == 2){
const pixels = new Float32Array(size); const pixels = new Float32Array(size);
gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer); gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, buffer);
gl2.getBufferSubData(gl2.PIXEL_PACK_BUFFER, 0, pixels); gl2.getBufferSubData(gl2.PIXEL_PACK_BUFFER, 0, pixels);
gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null); gl2.bindBuffer(gl2.PIXEL_PACK_BUFFER, null);
// log.start('后处理-readloop');
// let result = [];
// let offset = 0;
// for (let h = 0; h < this.height_texture_out; h++) {
// // 纪录第1和2行数据
// let temp1 = [];
// let temp2 = [];
// for (let w = 0; w < this.width_texture_out; w++) {
// temp1.push(pixels[offset]);
// temp1.push(pixels[offset + 1]);
// temp2.push(pixels[offset + 2]);
// temp2.push(pixels[offset + 3]);
// offset += 4;
// }
// result = result.concat(temp1);
// result = result.concat(temp2);
// }
let result = []; let result = [];
for (let i = 0; i < this.width_texture_out * this.height_texture_out; i++) { for (let i = 0; i < this.width_texture_out * this.height_texture_out; i++) {
result.push(pixels[4 * i]); result.push(pixels[4 * i]);
} }
// const result = Array.prototype.slice.call(pixels);
// console.dir(['result', result]);
// log.end('后处理-readloop');
return result; return result;
}
else {
let pixels = buffer;
let result = [];
for (let i = 0; i < this.width_texture_out * this.height_texture_out; i++) {
result.push(pixels[4 * i]);
}
return result;
}
} }
getWebglError(status) { getWebglError(status) {
const gl2 = this.gl; const gl2 = this.gl;
switch (status) { switch (status) {
...@@ -497,7 +528,7 @@ export default class gpu { ...@@ -497,7 +528,7 @@ export default class gpu {
createAndWaitForFence() { createAndWaitForFence() {
const gl2 = this.gl; const gl2 = this.gl;
const isFenceEnabled = (gl2.fenceSync !== null); const isFenceEnabled = (gl2.fenceSync != null);
let isFencePassed = () => true; let isFencePassed = () => true;
if (isFenceEnabled) { if (isFenceEnabled) {
const sync = gl2.fenceSync(gl2.SYNC_GPU_COMMANDS_COMPLETE, 0); const sync = gl2.fenceSync(gl2.SYNC_GPU_COMMANDS_COMPLETE, 0);
...@@ -531,10 +562,8 @@ export default class gpu { ...@@ -531,10 +562,8 @@ export default class gpu {
let pixels = new Float32Array(this.width_texture_out * this.height_texture_out * 4); let pixels = new Float32Array(this.width_texture_out * this.height_texture_out * 4);
// gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1); // gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);
const tt2 = +Date.now(); const tt2 = +Date.now();
gl.readPixels(0, 0, this.width_texture_out, this.height_texture_out, gl.RGBA, gl.FLOAT, pixels, 0); gl.readPixels(0, 0, this.width_texture_out, this.height_texture_out, gl.RGBA, gl.FLOAT, pixels);
// console.log('本次读取数据时间是' + (+Date.now() - tt2)+ ',' + (tt2 - tt)); // console.log('本次读取数据时间是' + (+Date.now() - tt2)+ ',' + (tt2 - tt));
// log.end('后处理-readinside');
// log.start('后处理-readloop');
let result = []; let result = [];
for (let i = 0; i < this.width_texture_out * this.height_texture_out; i++) { for (let i = 0; i < this.width_texture_out * this.height_texture_out; i++) {
result.push(pixels[4 * i]); result.push(pixels[4 * i]);
......
/* eslint-disable */ /* eslint-disable */
import GraphExecutor from '../executor/executor'; import GraphExecutor from '../executor/executor';
import IO from '../feed/imageFeed';
import Runtime from '../runtime/runtime'; import Runtime from '../runtime/runtime';
import OpData from '../utils/opData'; import OpData from '../utils/opData';
import Factory from '../factory/fshader/factory'; import Factory from '../factory/fshader/factory';
...@@ -92,9 +91,14 @@ export default class Graph { ...@@ -92,9 +91,14 @@ export default class Graph {
return; return;
} }
opindex++; opindex++;
// console.log(opindex);
//if (executor.opData) console.log(executor.opData.iLayer);
executor.execute(this.inst, this.isExecuted); executor.execute(this.inst, this.isExecuted);
if (false && executor.opData && opindex >= 184){
console.log('return!');
console.dir(executor);
console.dir(executor.type);
console.dir(this);
return;
}
if (executor.next) { if (executor.next) {
const id = executor.next; const id = executor.next;
const next = this.getTensor(id); const next = this.getTensor(id);
...@@ -199,105 +203,63 @@ export default class Graph { ...@@ -199,105 +203,63 @@ export default class Graph {
}); });
} }
execute_try(temp, ops, idtoindex, executed, inline, prev){
console.log('execute_try!first look at this op');
console.log(ops[temp]);
let canrun = this.checkifcanrun(temp, ops, idtoindex, executed);
if (canrun === false) {
// console.log('canrun === false!');
var a = inline.pop();
this.execute_try(idtoindex[a.id], ops, idtoindex, executed, inline, prev);
return;
}
if (prev >=0) {
ops[prev].next = ops[temp].id;
}
ops[temp].outputsName.forEach(function(item, index) {
executed[item] = true;
})
let next = this.getNextByOp(ops, ops[temp]);
// console.log('this is its next:');
// console.dir(next);
while (next.length === 1) {
let flag = true;
for (let i = 0; i < next[0].inputsName.length; i++){
if (executed[next[0].inputsName[i]] === false) flag = false;
}
if (flag === false) {
// console.log('can not execute next now! jump to another op:');
if (inline.length === 0) return;
prev = temp;
let a = inline.pop();
// console.dir(a);
ops[temp].next = a.id;
temp = idtoindex[a.id];
this.execute_try(temp, ops, idtoindex, executed, inline, prev);
return;
}
else {
// console.log('now execute next op! it is');
ops[temp].next = next[0].id;
temp = idtoindex[next[0].id];
// console.dir(ops[temp]);
next = this.getNextByOp(ops, ops[temp]);
// console.log('its next is: ');
ops[temp].outputsName.forEach(function(item, index) {
executed[item] = true;
})
// console.dir(next);
}
}
if (next.length > 1){
// console.log('next.length > 1!!!');
for (let i = next.length - 1; i >=0 ; i--){
inline.push(next[i]);
}
var a = inline.pop();
this.execute_try(idtoindex[a.id], ops, idtoindex, executed, inline, temp);
}
return;
}
arrangeMap(ops) { arrangeMap(ops) {
// console.log('arrangeMap!');
// console.dir(ops);
var idtoindex = {};
var executed = {}; var executed = {};
var inline = []; var inIndex = [];
var idtoindex = {};
let temp = 0; let temp = 0;
// console.log('graph ops:');
// console.dir(ops);
let ops1 = ops; let ops1 = ops;
ops1.forEach(function(item, index) { ops1.forEach(function(item, index) {
idtoindex[item.id] = index;
// console.dir(item);
item.outputsName.forEach(function(i, idx){ item.outputsName.forEach(function(i, idx){
executed[i] = false; executed[i] = true;
}) })
}); });
//ops[0].inputsName[0] = {name : "feed"}; ops1.forEach(function(item, index) {
// ops[0].outputsName[0] = {name : "image"}; inIndex[index] = 0;
this.execute_try(temp, ops, idtoindex, executed, inline, -1); idtoindex[item.id] = index;
if (item.inputsName.length > 1) {
item.inputsName.forEach(function(i,idx){
if (executed[i] == true) inIndex[index]++;
})
}
else inIndex[index] = item.inputsName.length;
});
this.topoSort(ops, inIndex, idtoindex);
return ops; return ops;
} }
checkifcanrun(temp, ops, executed){ topoSort(ops, inIndex, idtoindex){
if (!ops[temp].inputsName) return true; var inline = [];
for (let i = 0; i < ops[temp].inputsName.length; i++){ inline.push(ops[0]);
if (executed[ops[temp].inputsName[i]] === false) return false; let ops_temp = ops.slice(0);
let prev = null;
let a = ops[0];
while(inline.length > 0){
if (prev != null) ops[idtoindex[prev.id]].next = a.id;
prev = a;
a = inline.pop();
for (let i = 0; i < a.outputsName.length; i++){
for (let k = 0; k < ops_temp.length; k++){
for (let j = 0; j < ops_temp[k].inputsName.length; j++){
if (ops_temp[k].inputsName[j] == a.outputsName[i]) {
inIndex[idtoindex[ops_temp[k].id]]--;
if (inIndex[idtoindex[ops_temp[k].id]] == 0){
inline.push(ops[idtoindex[ops_temp[k].id]]);
ops_temp.splice(k,1);
k--;
break;
}
}
}
}
}
} }
return true;
} }
/** /**
* Get Ops Nets Start Node * Get Ops Nets Start Node
* @param ops * @param ops
...@@ -348,8 +310,6 @@ export default class Graph { ...@@ -348,8 +310,6 @@ export default class Graph {
* @returns {*} * @returns {*}
*/ */
createOpsMap(ops) { createOpsMap(ops) {
// console.log('ops!!');
// console.dir(ops);
return ops.map((item, idx) => { return ops.map((item, idx) => {
item.idx = idx; item.idx = idx;
const graphExecutor = new GraphExecutor(item); const graphExecutor = new GraphExecutor(item);
...@@ -372,17 +332,6 @@ export default class Graph { ...@@ -372,17 +332,6 @@ export default class Graph {
}); });
} }
getNextByOp(ops, op) {
return ops.filter((item, key) => {
for (let i = 0; i < item.inputsName.length; i++) {
for(let j = 0; j < op.outputsName.length; j++) {
if (item.inputsName[i] === op.outputsName[j]) {
return true;
}
}
}
});
}
/** /**
* dispose * dispose
*/ */
......
...@@ -109,8 +109,9 @@ export default class Loader { ...@@ -109,8 +109,9 @@ export default class Loader {
const TMP_REGEX = /\-/; const TMP_REGEX = /\-/;
let requesterArr = arr.map(item => { let requesterArr = arr.map(item => {
if (item.name if (item.name
&& item.name.match(TMP_SCHEME_REGEX) === null // && item.name.match(TMP_SCHEME_REGEX) === null
&& item.name.match(TMP_REGEX) === null) { // && item.name.match(TMP_REGEX) === null
) {
return this.fetchData(item.name).then(data => item.data = data); return this.fetchData(item.name).then(data => item.data = data);
} }
return Promise.resolve(); return Promise.resolve();
...@@ -124,9 +125,9 @@ export default class Loader { ...@@ -124,9 +125,9 @@ export default class Loader {
let marker = 0; // 读到哪个位置了 let marker = 0; // 读到哪个位置了
let len; // 当前op长度 let len; // 当前op长度
arr.filter(item => { arr.filter(item => {
return item.name return item.name;
&& item.name.match(TMP_SCHEME_REGEX) === null // && item.name.match(TMP_SCHEME_REGEX) === null
&& item.name.match(TMP_REGEX) === null; // && item.name.match(TMP_REGEX) === null;
}) })
// .sort((a, b) => { // .sort((a, b) => {
// if (a.name > b.name) { // if (a.name > b.name) {
......
...@@ -48,13 +48,9 @@ export default class Paddle { ...@@ -48,13 +48,9 @@ export default class Paddle {
that.graph = graph; that.graph = graph;
that.graph.data = artifacts.data; that.graph.data = artifacts.data;
that.graph.formatWeight(that.graph.data.vars); that.graph.formatWeight(that.graph.data.vars);
const opsMap = that.graph.createOpsMap(that.graph.data.ops, that.graph.data.vars); const opsMap = that.graph.createOpsMap(that.graph.data.ops);
const opsMap1 = that.graph.constructOpsMap(opsMap); const opsMap1 = that.graph.constructOpsMap(opsMap);
// console.log('opsMap1!');
// console.dir(opsMap1);
const opsMap2 = that.graph.arrangeMap(opsMap1); const opsMap2 = that.graph.arrangeMap(opsMap1);
// console.log('opsMap2!');
// console.dir(opsMap2);
that.graph.weightMap = opsMap2; that.graph.weightMap = opsMap2;
} }
/** /**
...@@ -68,10 +64,10 @@ export default class Paddle { ...@@ -68,10 +64,10 @@ export default class Paddle {
this.feed = this.graph.feed = inputs; this.feed = this.graph.feed = inputs;
// 生成op数据 // 生成op数据
if (!this.graph.isExecuted) { if (!this.graph.isExecuted) {
this.graph.weightMap.forEach(op => { this.graph.weightMap.forEach((op, index) => {
const type = op.type; const type = op.type;
if (type !== 'feed' && type !== 'fetch') { if (type !== 'feed' && type !== 'fetch') {
console.log(op.type);
that.graph.buildOpData(op); that.graph.buildOpData(op);
} }
}); });
...@@ -81,7 +77,6 @@ export default class Paddle { ...@@ -81,7 +77,6 @@ export default class Paddle {
} }
updateFeed() { updateFeed() {
this.graph.feedItem.data = this.graph.feed.input[0].data; this.graph.feedItem.data = this.graph.feed.input[0].data;
// Utils.img2texture(this.graph.feedItem);
} }
/** /**
* dispose * dispose
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
import Gpu from '../gpu/gpu'; import Gpu from '../gpu/gpu';
import getMaxUniforms from '../test/getMaxUniforms'; import getMaxUniforms from '../test/getMaxUniforms';
import Factory from '../factory/fshader/factory'; import Factory from '../factory/fshader/factory';
// import {getTextureShapeInfo} from '../utils/opData';
// 生成factory实例
// const factory = new Factory({});
/** /**
* @file gpu运行时 * @file gpu运行时
* @author wangqun@baidu.com, yangmingming@baidu.com * @author wangqun@baidu.com, yangmingming@baidu.com
...@@ -29,6 +26,14 @@ export default { ...@@ -29,6 +26,14 @@ export default {
return this.gpu.getWebglVersion(); return this.gpu.getWebglVersion();
}, },
getWebglMaxTextureSize() {
return this.gpu.maxTextureSize();
},
getWebglMaxTextureImageUnits() {
return this.gpu.maxTextureImageUnits();
},
run(opName, opData, isRendered) { run(opName, opData, isRendered) {
// console.dir(['fscode', opData.fsCode]); // console.dir(['fscode', opData.fsCode]);
// let time = +Date.now(); // let time = +Date.now();
...@@ -64,6 +69,7 @@ export default { ...@@ -64,6 +69,7 @@ export default {
this.gpu.render(opData.renderData, opData.iLayer, isRendered); this.gpu.render(opData.renderData, opData.iLayer, isRendered);
// } // }
}); });
}, },
/** /**
......
...@@ -7,29 +7,38 @@ ...@@ -7,29 +7,38 @@
export default ` export default `
// 根据tensor坐标获取这个tensor位置的值 // 根据tensor坐标获取这个tensor位置的值
float getValueFromTensorPos_TENSOR_NAME(int r, int g, int b, int a) { float getValueFromTensorPos_TENSOR_NAME(int r, int g, int b, int a) {
vec4 pixels = TEXTURE2D(texture_TENSOR_NAME, vec4 pixels = TEXTURE2D(texture_TENSOR_NAME,
vec2( vec2(
(float(a * channel_TENSOR_NAME + g) + 0.5) / float(width_texture_TENSOR_NAME), (float(a * channel_TENSOR_NAME + g) + 0.5) / float(width_texture_TENSOR_NAME),
(float(r * height_shape_TENSOR_NAME + b) + 0.5) / float(height_texture_TENSOR_NAME) (float(r * height_shape_TENSOR_NAME + b) + 0.5) / float(height_texture_TENSOR_NAME)
) )
); );
// 只用了r通道 // 只用了r通道
return pixels.r; return pixels.r;
} }
// 紧凑型布局根据tensor坐标获取这个tensor位置的值
// 超限布局根据tensor坐标获取这个tensor位置的值
float getValueFromTensorPosLimit_TENSOR_NAME(int r, int g, int b, int a) { float getValueFromTensorPosLimit_TENSOR_NAME(int r, int g, int b, int a) {
float halfW = ceil(float(width_shape_TENSOR_NAME) / 2.0); float pieceW = ceil(float(width_shape_TENSOR_NAME) / 4.0);
int x = int(mod(float(a), halfW)); int x = int(mod(float(a), pieceW));
int offsetY = 0; int offsetY = 0;
if (a > x) {
if ((float(a) / pieceW) >= 3.0) {
offsetY = 3 * height_shape_TENSOR_NAME;
}
else if (float(a) / pieceW >= 2.0) {
offsetY = 2 * height_shape_TENSOR_NAME;
}
else if (float(a) >= pieceW) {
offsetY = height_shape_TENSOR_NAME; offsetY = height_shape_TENSOR_NAME;
} }
vec4 pixels = TEXTURE2D(texture_TENSOR_NAME, vec4 pixels = TEXTURE2D(texture_TENSOR_NAME,
vec2( vec2(
(float(x * channel_TENSOR_NAME + g) + 0.5) / float(width_texture_TENSOR_NAME), (float(x * channel_TENSOR_NAME + g) + 0.5) / float(width_texture_TENSOR_NAME),
(float(r * 2 * height_shape_TENSOR_NAME + b + offsetY) + 0.5) / float(height_texture_TENSOR_NAME) (float(r * 4 * height_shape_TENSOR_NAME + b + offsetY) + 0.5) / float(height_texture_TENSOR_NAME)
) )
); );
return pixels.r; return pixels.r;
} }
`; `;
...@@ -8,11 +8,13 @@ export default ` ...@@ -8,11 +8,13 @@ export default `
precision highp float; precision highp float;
precision highp int; precision highp int;
#else #else
precision mediump float; precision highp float;
precision mediump int; precision highp int;
#endif #endif
varying vec2 vCoord;
varying vec4 outColor;
void setOutput(float result) { void setOutput(float result) {
gl_FragColor.r = result; gl_FragColor.r = result;
} }
`; `;
...@@ -15,17 +15,18 @@ ivec4 getOutputTensorPos() { ...@@ -15,17 +15,18 @@ ivec4 getOutputTensorPos() {
return ivec4(b, c, y, x); return ivec4(b, c, y, x);
} }
ivec4 getOutputTensorPosLimit() { ivec4 getOutputTensorPosLimit() {
// 获取原始长度 // 获取原始长度
vec2 outCoord = vCoord.xy * _2d_shape_texture_out; vec2 outCoord = vCoord.xy * _2d_shape_texture_out;
float offsetY = floor(outCoord.y / float(height_shape_out)); float offsetY = floor(outCoord.y / float(height_shape_out));
int x = int(outCoord.x / float(channel_out)); int x = int(outCoord.x / float(channel_out));
if (mod(offsetY, 2.0) > 0.0) { if (mod(offsetY, 4.0) > 0.0) {
x += int(ceil(float(width_shape_out) / 2.0)); x += int(mod(offsetY, 4.0)) * int(ceil(float(width_shape_out) / 4.0));
} }
int y = int(mod(outCoord.y, float(height_shape_out))); int y = int(mod(outCoord.y, float(height_shape_out)));
int c = int(mod(outCoord.x, float(channel_out))); int c = int(mod(outCoord.x, float(channel_out)));
int b = int(outCoord.y / float(2 * height_shape_out)); int b = int(outCoord.y / float(4 * height_shape_out));
return ivec4(b, c, y, x); return ivec4(b, c, y, x);
} }
......
...@@ -10,13 +10,13 @@ export default ` ...@@ -10,13 +10,13 @@ export default `
ivec4 transferFromNHWCtoNCHW( int sumVal, const int channel, const int width_shape, const int height_shape, const int total_shape) { ivec4 transferFromNHWCtoNCHW( int sumVal, const int channel, const int width_shape, const int height_shape, const int total_shape) {
int n_origin = int(total_shape/(channel * width_shape * height_shape)); int n_origin = int(total_shape/(channel * width_shape * height_shape));
int new_a = sumVal % width_shape; int new_a = int(mod(float(sumVal), float(width_shape)));
sumVal = int((sumVal - new_a) / width_shape); sumVal = int((sumVal - new_a) / width_shape);
int new_b = sumVal % height_shape; int new_b = int(mod(float(sumVal), float(height_shape)));
sumVal = int((sumVal - new_b) / height_shape); sumVal = int((sumVal - new_b) / height_shape);
int new_g = sumVal % channel; int new_g = int(mod(float(sumVal), float(channel)));
sumVal = int((sumVal - new_g) / channel); sumVal = int((sumVal - new_g) / channel);
int new_r = sumVal % n_origin; int new_r = int(mod(float(sumVal), float(n_origin)));
return ivec4(new_r,new_g,new_b,new_a); return ivec4(new_r,new_g,new_b,new_a);
} }
`; `;
...@@ -7,14 +7,14 @@ export default ` ...@@ -7,14 +7,14 @@ export default `
// start函数 // start函数
void main(void) { void main(void) {
// 输出数据 // 输出数据
ivec4 oPos = getOutputTensorPos(); ivec4 oPos = getOutputTensorPosLIMIT_OUT();
float o = getValueFromTensorPos_origin(oPos.r, oPos.g, oPos.b, oPos.a); float o = getValueFromTensorPosLIMIT_ORIGIN_origin(oPos.r, oPos.g, oPos.b, oPos.a);
// 归一化数据 // 归一化数据
vec4 scale = getPixelsFromTexturePos_texture_scale(vec2( float(oPos.g) / float(width_texture_scale), 0.0)); vec4 scale = getPixelsFromTexturePos_texture_scale(vec2((float(oPos.g) + 0.5) / float(width_texture_scale), 0.0));
vec4 bias = getPixelsFromTexturePos_texture_bias(vec2((float(oPos.g)) / float(width_texture_bias), 0.0)); vec4 bias = getPixelsFromTexturePos_texture_bias(vec2((float(oPos.g) + 0.5) / float(width_texture_bias), 0.0));
vec4 mean = getPixelsFromTexturePos_texture_mean(vec2((float(oPos.g)) / float(width_texture_mean), 0.0)); vec4 mean = getPixelsFromTexturePos_texture_mean(vec2((float(oPos.g) + 0.5) / float(width_texture_mean), 0.0));
vec4 variance = getPixelsFromTexturePos_texture_variance(vec2((float(oPos.g)) / float(width_texture_variance), 0.0)); vec4 variance = getPixelsFromTexturePos_texture_variance(vec2((float(oPos.g) + 0.5) / float(width_texture_variance), 0.0));
float x = (o - mean[0]) / sqrt(variance[0] + epsilon); float x = (o - mean[0]) / sqrt(variance[0] + epsilon);
float res = scale[0] * x + bias[0]; float res = scale[0] * x + bias[0];
......
/* eslint-disable */
/**
* @file bilinear_interp的配置文件
* @author chenhaoze
*/
export default {
dep: [
{
func: 'getValueFromTensorPos',
conf: {
TENSOR_NAME: 'origin'
}
},
{
func: 'transferFromNHWCtoNCHW',
conf:{
}
}
],
conf: [
'WIDTH_SHAPE_ORIGIN',
'HEIGHT_SHAPE_ORIGIN',
'LENGTH_SHAPE_ORIGIN',
'WIDTH_TEXTURE_ORIGIN',
'HEIGHT_TEXTURE_ORIGIN',
'CHANNEL_ORIGIN',
'WIDTH_SHAPE_OUT',
'HEIGHT_SHAPE_OUT',
'WIDTH_TEXTURE_OUT',
'HEIGHT_TEXTURE_OUT',
'CHANNEL_OUT',
'OFFSET_Y_OUT',
'MULTI_VALUE',
'BIAS_VALUE',
'ACTIVE_FUNCTION'
],
input: [
{
tensor: 'origin',
variable: 'texture',
setter: 'initTexture',
type: 'texture'
}
]
};
/* eslint-disable */
/**
* @file bilinear_interp主函数
* @author chenhaoze
*/
export default `
// start函数
void main(void) {
// 输出数据
ivec4 oPos = getOutputTensorPos();
// 输出坐标转换为输入坐标
//int sumVal = oPos.g + oPos.a * channel_out + oPos.b * channel_out * width_shape_out + oPos.r * channel_out * width_shape_out * height_shape_out;
//oPos = transferFromNHWCtoNCHW(sumVal, channel_out, width_shape_out, height_shape_out, total_shape_out);
float o = getValueFromTensorPos_origin(oPos.r, oPos.g, oPos.b, oPos.a);
float scale_x = float(width_shape_out - 1) / float(width_shape_origin - 1);
float scale_y = float(height_shape_out - 1) / float(height_shape_origin - 1);
float x = float(oPos.a) / scale_x;
float y = float(oPos.b) / scale_y;
int x1 = int(floor(x));
int y1 = int(floor(y));
int x2 = int(ceil(x));
int y2 = int(ceil(y));
float dist_x = x - float(x1);
float dist_y = y - float(y1);
float value11 = getValueFromTensorPos_origin(oPos.r, oPos.g, y1, x1);
float value12 = getValueFromTensorPos_origin(oPos.r, oPos.g, y2, x1);
float value21 = getValueFromTensorPos_origin(oPos.r, oPos.g, y1, x2);
float value22 = getValueFromTensorPos_origin(oPos.r, oPos.g, y2, x2);
float value = (1.0 - dist_x) * (1.0 - dist_y) * value11 +
(1.0 - dist_x) * dist_y * value12 + dist_x * (1.0 - dist_y) * value21 +
dist_x * dist_y * value22;
setOutput(float(value));
}
`;
/* eslint-disable */
/**
* @file bilinear_interp参数文件
* @author chenhaoze
*/
export default `
// 输入数据
const int width_shape_origin = WIDTH_SHAPE_ORIGIN;
const int height_shape_origin = HEIGHT_SHAPE_ORIGIN;
const int length_shape_origin = LENGTH_SHAPE_ORIGIN;
const int width_texture_origin = WIDTH_TEXTURE_ORIGIN;
const int height_texture_origin = HEIGHT_TEXTURE_ORIGIN;
const int channel_origin = CHANNEL_ORIGIN;
const int total_shape_origin = TOTAL_SHAPE_ORIGIN;
const int total_shape_out = TOTAL_SHAPE_OUT;
// 输入数据
uniform sampler2D texture_origin;
`;
...@@ -11,8 +11,8 @@ void main(void) { ...@@ -11,8 +11,8 @@ void main(void) {
// int sumVal = oPos.g + oPos.a * channel_out + oPos.b * channel_out * width_shape_out + oPos.r * channel_out * width_shape_out * height_shape_out; // int sumVal = oPos.g + oPos.a * channel_out + oPos.b * channel_out * width_shape_out + oPos.r * channel_out * width_shape_out * height_shape_out;
// ivec4 new_oPos = transferFromNHWCtoNCHW(sumVal, channel_out, width_shape_out, height_shape_out, total_shape_out); // ivec4 new_oPos = transferFromNHWCtoNCHW(sumVal, channel_out, width_shape_out, height_shape_out, total_shape_out);
float o = 0.0; float o = 0.0;
if (oPos[dim] > inputs_dim[0] - 1) { if (oPos[dim] > inputs_dim - 1) {
oPos[dim] = oPos[dim] - inputs_dim[0]; oPos[dim] = oPos[dim] - inputs_dim;
o = getValueFromTensorPos_counter(oPos.r, oPos.g, oPos.b, oPos.a); o = getValueFromTensorPos_counter(oPos.r, oPos.g, oPos.b, oPos.a);
} }
else { else {
......
...@@ -28,7 +28,7 @@ const int total_shape_origin = TOTAL_SHAPE_ORIGIN; ...@@ -28,7 +28,7 @@ const int total_shape_origin = TOTAL_SHAPE_ORIGIN;
const int total_shape_out = TOTAL_SHAPE_OUT; const int total_shape_out = TOTAL_SHAPE_OUT;
const int dim = DIM; const int dim = DIM;
const int inputs_dim[1] = int[](INPUTS_DIM); const int inputs_dim = INPUTS_DIM;
// uniform变量 // uniform变量
......
...@@ -16,16 +16,8 @@ export default ` ...@@ -16,16 +16,8 @@ export default `
int temp_y = 0; int temp_y = 0;
float o = 0.0; float o = 0.0;
float f = 0.0; float f = 0.0;
if (x % 2 == 1) x = x - 2; if (int(mod(float(x), 2.0)) == 1) x = x - 2;
if (y % 2 == 1) y = y - 2; if (int(mod(float(y), 2.0)) == 1) y = y - 2;
// 重排遍历顺序
//int sumVal = oPos.g + oPos.a * channel_out + oPos.b * channel_out * width_shape_out;
//int new_a = sumVal % width_shape_out;
//int new_b = int((sumVal - new_a) / width_shape_out) % height_shape_out;
//int new_g = int((((sumVal - new_a) / width_shape_out) - new_b) / height_shape_out);
//int x = new_a;
//int c = new_g;
//int y = new_b;
// 获取output的坐标 // 获取output的坐标
int oTensorChannel = int(c * groups / channel_out) * channel_origin; int oTensorChannel = int(c * groups / channel_out) * channel_origin;
int oy = y; int oy = y;
...@@ -43,8 +35,7 @@ export default ` ...@@ -43,8 +35,7 @@ export default `
} }
// channel计算 // channel计算
for (int j = 0; j < channel_origin; j++) { for (int j = 0; j < channel_origin; j++) {
if (int(mod(float(ox), float(stride_h))) == 0 && int(mod(float(oy), float(stride_v))) == 0) {
if (ox % stride_h == 0 && oy % stride_v == 0) {
temp_x = int(floor(float(ox) / float(stride_h))); temp_x = int(floor(float(ox) / float(stride_h)));
temp_y = int(floor(float(oy) / float(stride_v))); temp_y = int(floor(float(oy) / float(stride_v)));
if (temp_x < width_shape_origin && temp_y < height_shape_origin){ if (temp_x < width_shape_origin && temp_y < height_shape_origin){
......
...@@ -7,22 +7,22 @@ export default ` ...@@ -7,22 +7,22 @@ export default `
// start函数 // start函数
void main(void) { void main(void) {
// 输出数据 // 输出数据
ivec4 oPos = getOutputTensorPos(); ivec4 oPos = getOutputTensorPosLIMIT_OUT();
float o = getValueFromTensorPos_origin(oPos.r, oPos.g, oPos.b, oPos.a); float o = getValueFromTensorPosLIMIT_ORIGIN_origin(oPos.r, oPos.g, oPos.b, oPos.a);
ivec4 pos_counter; ivec4 pos_counter;
float c = 0.0; float c = 0.0;
if (axis == 1){ if (axis == 1){
c = getValueFromTensorPos_counter(0, oPos.r, oPos.g, oPos.b); c = getValueFromTensorPosLIMIT_COUNTER_counter(0, oPos.r, oPos.g, oPos.b);
} }
else if (axis == 2){ else if (axis == 2){
c = getValueFromTensorPos_counter(0, 0, oPos.r, oPos.g); c = getValueFromTensorPosLIMIT_COUNTER_counter(0, 0, oPos.r, oPos.g);
} }
else if (axis == 3){ else if (axis == 3){
c = getValueFromTensorPos_counter(0, 0, 0, oPos.r); c = getValueFromTensorPosLIMIT_COUNTER_counter(0, 0, 0, oPos.r);
} }
else { else {
c = getValueFromTensorPos_counter(oPos.r, oPos.g, oPos.b, oPos.a); c = getValueFromTensorPosLIMIT_COUNTER_counter(oPos.r, oPos.g, oPos.b, oPos.a);
} }
float res = c + o; float res = c + o;
setOutput(float(res)); setOutput(float(res));
......
...@@ -7,10 +7,10 @@ export default ` ...@@ -7,10 +7,10 @@ export default `
void main(void) { void main(void) {
float res = 0.0; float res = 0.0;
// 获取output的坐标 // 获取output的坐标
ivec4 out_pos = getOutputTensorPos(); ivec4 out_pos = getOutputTensorPosLIMIT_OUT();
for (int j = 0; j < width_shape_origin; j++) { for (int j = 0; j < width_shape_origin; j++) {
float c = getValueFromTensorPos_counter(out_pos[0], out_pos[1], j, out_pos[3]); float c = getValueFromTensorPosLIMIT_COUNTER_counter(out_pos[0], out_pos[1], j, out_pos[3]);
float o = getValueFromTensorPos_origin(out_pos[0], out_pos[1], out_pos[2], j); float o = getValueFromTensorPosLIMIT_COUNTER_origin(out_pos[0], out_pos[1], out_pos[2], j);
res += c * o; res += c * o;
} }
setOutput(res); setOutput(res);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
export default ` export default `
// start函数 // start函数
void main(void) { void main(void) {
int length = int(target_value.length() / num); int length = int(target_length / num);
ivec4 oPos = getOutputTensorPos(); ivec4 oPos = getOutputTensorPos();
// 输出坐标转换为输入坐标 // 输出坐标转换为输入坐标
//int sumVal = oPos.g + oPos.a * channel_out + oPos.b * channel_out * width_shape_out + oPos.r * channel_out * width_shape_out * height_shape_out; //int sumVal = oPos.g + oPos.a * channel_out + oPos.b * channel_out * width_shape_out + oPos.r * channel_out * width_shape_out * height_shape_out;
......
...@@ -18,7 +18,7 @@ const int total_shape_out = TOTAL_SHAPE_OUT; ...@@ -18,7 +18,7 @@ const int total_shape_out = TOTAL_SHAPE_OUT;
const int dim = DIM; const int dim = DIM;
const int num = NUM; const int num = NUM;
const int target_value[TARGET_LENGTH] = int[](TARGET_VALUE); const int target_length = TARGET_LENGTH;
// 输入数据 // 输入数据
......
...@@ -19,10 +19,10 @@ void main(void) { ...@@ -19,10 +19,10 @@ void main(void) {
o = getValueFromTensorPos_origin(oPos[0], oPos[1], oPos[2], oPos[3]); o = getValueFromTensorPos_origin(oPos[0], oPos[1], oPos[2], oPos[3]);
} }
else if (perm_size == 2) { else if (perm_size == 2) {
o = getValueFromTensorPos_origin(oPos[0], oPos[1], oPos[min(2 + perm_0, 3)], oPos[min(2 + perm_1, 3)]); o = getValueFromTensorPos_origin(oPos[0], oPos[1], oPos[(2 + perm_0)>3?3:(2 + perm_0)], oPos[(2 + perm_1)>3?3:(2 + perm_1)]);
} }
else if (perm_size == 3) { else if (perm_size == 3) {
o = getValueFromTensorPos_origin(oPos[0], oPos[min(1 + perm_0, 3)], oPos[min(1 + perm_1, 3)], oPos[min(1 + perm_2, 3)]); o = getValueFromTensorPos_origin(oPos[0], oPos[(1 + perm_0)>3?3:(1 + perm_0)], oPos[(1 + perm_1)>3?3:(1 + perm_1)], oPos[(1 + perm_2)>3?3:(1 + perm_2)]);
} }
else if (perm_size == 4) { else if (perm_size == 4) {
o = getValueFromTensorPos_origin(oPos[perm_0], oPos[perm_1], oPos[perm_2], oPos[perm_3]); o = getValueFromTensorPos_origin(oPos[perm_0], oPos[perm_1], oPos[perm_2], oPos[perm_3]);
......
...@@ -125,7 +125,6 @@ const mergeType = 'conv2d-elementwise_add'; ...@@ -125,7 +125,6 @@ const mergeType = 'conv2d-elementwise_add';
export default class OpData { export default class OpData {
constructor(name, input = {}, output = {}, attrs = {}) { constructor(name, input = {}, output = {}, attrs = {}) {
// console.dir(this);
this.realName = name; this.realName = name;
this.name = name; this.name = name;
this.attrs = attrs; this.attrs = attrs;
...@@ -205,7 +204,6 @@ export default class OpData { ...@@ -205,7 +204,6 @@ export default class OpData {
// 默认取第一个数据 // 默认取第一个数据
const data = this.output[key] || [{}]; const data = this.output[key] || [{}];
if (tensorName[key.toLowerCase()]) { if (tensorName[key.toLowerCase()]) {
// console.dir(this);
data.forEach(item => { data.forEach(item => {
item.tensorName = tensorName[key.toLowerCase()]; item.tensorName = tensorName[key.toLowerCase()];
tensorData.push(item); tensorData.push(item);
...@@ -453,7 +451,7 @@ export default class OpData { ...@@ -453,7 +451,7 @@ export default class OpData {
this.attrs.target_length = dim_value.length; this.attrs.target_length = dim_value.length;
this.attrs.target_value = dim_value; this.attrs.target_value = dim_value;
// 保存 输入 tensor 对应dim 的长度 // 保存 输入 tensor 对应dim 的长度
this.attrs.inputs_dim = [origin_shape[axis]]; this.attrs.inputs_dim = origin_shape[axis];
this.attrs.dim = 4 - origin_shape.length + axis; this.attrs.dim = 4 - origin_shape.length + axis;
} }
......
...@@ -119,12 +119,13 @@ export default { ...@@ -119,12 +119,13 @@ export default {
let offsetY = 0; let offsetY = 0;
// 安卓和ios的max texture size是4096, 改造存储空间(2bh, cw / 2) // 安卓和ios的max texture size是4096, 改造存储空间(2bh, cw / 2)
let exceedMax = false; let exceedMax = false;
// FIXME:为了让mobilenet能正常执行,这里先注释掉,待群哥修复 // trick TEXTURE_SIZE 超限问题,后续升级更优解
// if (height > MAX_TEXTURE_SIZE || width > MAX_TEXTURE_SIZE) { if (height > 4096 || width > 4096) {
// height *= 2; //console.error('大小超限', shape);
// width = c * (Math.ceil(w / 2)); //height *= 4;
// exceedMax = true; //width = c * (Math.ceil(w / 4));
// } //exceedMax = true;
}
if (isPacked) { if (isPacked) {
// 紧凑布局 // 紧凑布局
height = b * c * Math.ceil(h / 2); height = b * c * Math.ceil(h / 2);
...@@ -203,7 +204,7 @@ export default { ...@@ -203,7 +204,7 @@ export default {
return fourDimShape; return fourDimShape;
}, },
/* /*
* 将nhwc排布数据转为nchw排布数据 * 将nhwc排布数据转为nchw排布数据
*/ */
nhwc2nchw(data, shape) { nhwc2nchw(data, shape) {
...@@ -226,7 +227,7 @@ export default { ...@@ -226,7 +227,7 @@ export default {
return nchwData; return nchwData;
}, },
/* /*
* 将nchw排布数据转为nhwc排布数据 * 将nchw排布数据转为nhwc排布数据
*/ */
nchw2nhwc(data, shape) { nchw2nhwc(data, shape) {
...@@ -249,9 +250,9 @@ export default { ...@@ -249,9 +250,9 @@ export default {
return nhwcData; return nhwcData;
}, },
/* /*
* 等距间隔打印数据 * 等距间隔打印数据
*/ */
stridePrint(data, count = 20) { stridePrint(data, count = 20) {
let realPrintCount = count; let realPrintCount = count;
if (data.length <= realPrintCount) { if (data.length <= realPrintCount) {
...@@ -267,10 +268,10 @@ export default { ...@@ -267,10 +268,10 @@ export default {
for (let i = 0; i < realPrintCount; i++) { for (let i = 0; i < realPrintCount; i++) {
numbers.push(i * stride + ": " + data[i * stride]); numbers.push(i * stride + ": " + data[i * stride]);
} }
console.log(numbers) console.log(numbers);
}, },
/* /*
* 连续打印数据 * 连续打印数据
*/ */
continuousPrint(data, count = 100) { continuousPrint(data, count = 100) {
...@@ -282,7 +283,7 @@ export default { ...@@ -282,7 +283,7 @@ export default {
for (let i = 0; i < realPrintCount; i++) { for (let i = 0; i < realPrintCount; i++) {
numbers.push(i + ": " + data[i]); numbers.push(i + ": " + data[i]);
} }
console.log(numbers) console.log(numbers);
}, },
softmax(nchwData) { softmax(nchwData) {
...@@ -306,6 +307,44 @@ export default { ...@@ -306,6 +307,44 @@ export default {
} }
return result; return result;
},
// 针对model final texture输出超限后,inst.read读取数据不对的case
formatReadData(nchwData, nchwShape) {
if (nchwShape.length < 4) {
let batch = [];
for (let i = 0; i < (4 - nchwShape.length); i++) {
batch.push(1);
}
nchwShape = batch.concat(nchwShape);
}
const shape_b = nchwShape[0];
const shape_c = nchwShape[1];
const shape_h = nchwShape[2];
const shape_w = nchwShape[3];
const texture_height = shape_b * shape_h;
const texture_width = shape_c * shape_w;
if (texture_height <= 4096 && texture_width <= 4096) {
return nchwData;
}
let pos = 0;
const formatData = [];
const pieceW = Math.ceil(shape_w / 4); // reshape后的 shape_width
for (let bIndex = 0; bIndex < shape_b; bIndex++) {
for (let cIndex = 0; cIndex < shape_c; cIndex++) {
for (let hIndex = 0; hIndex < shape_h; hIndex++) {
for (let wIndex = 0; wIndex < shape_w; wIndex++) {
pos = Math.floor(wIndex / pieceW) * pieceW * (shape_h - 1) + wIndex + hIndex * pieceW;
pos += bIndex * shape_c * shape_h * shape_w+ cIndex * shape_h * shape_w;
formatData.push(nchwData[pos]);
}
}
}
}
return formatData;
} }
}; };
/* eslint-enable */ /* eslint-enable */
{0: 'tench, Tinca tinca', {
1: 'goldfish, Carassius auratus', "0": "tench, Tinca tinca",
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', "1": "goldfish, Carassius auratus",
3: 'tiger shark, Galeocerdo cuvieri', "2": "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",
4: 'hammerhead, hammerhead shark', "3": "tiger shark, Galeocerdo cuvieri",
5: 'electric ray, crampfish, numbfish, torpedo', "4": "hammerhead, hammerhead shark",
6: 'stingray', "5": "electric ray, crampfish, numbfish, torpedo",
7: 'cock', "6": "stingray",
8: 'hen', "7": "cock",
9: 'ostrich, Struthio camelus', "8": "hen",
10: 'brambling, Fringilla montifringilla', "9": "ostrich, Struthio camelus",
11: 'goldfinch, Carduelis carduelis', "10": "brambling, Fringilla montifringilla",
12: 'house finch, linnet, Carpodacus mexicanus', "11": "goldfinch, Carduelis carduelis",
13: 'junco, snowbird', "12": "house finch, linnet, Carpodacus mexicanus",
14: 'indigo bunting, indigo finch, indigo bird, Passerina cyanea', "13": "junco, snowbird",
15: 'robin, American robin, Turdus migratorius', "14": "indigo bunting, indigo finch, indigo bird, Passerina cyanea",
16: 'bulbul', "15": "robin, American robin, Turdus migratorius",
17: 'jay', "16": "bulbul",
18: 'magpie', "17": "jay",
19: 'chickadee', "18": "magpie",
20: 'water ouzel, dipper', "19": "chickadee",
21: 'kite', "20": "water ouzel, dipper",
22: 'bald eagle, American eagle, Haliaeetus leucocephalus', "21": "kite",
23: 'vulture', "22": "bald eagle, American eagle, Haliaeetus leucocephalus",
24: 'great grey owl, great gray owl, Strix nebulosa', "23": "vulture",
25: 'European fire salamander, Salamandra salamandra', "24": "great grey owl, great gray owl, Strix nebulosa",
26: 'common newt, Triturus vulgaris', "25": "European fire salamander, Salamandra salamandra",
27: 'eft', "26": "common newt, Triturus vulgaris",
28: 'spotted salamander, Ambystoma maculatum', "27": "eft",
29: 'axolotl, mud puppy, Ambystoma mexicanum', "28": "spotted salamander, Ambystoma maculatum",
30: 'bullfrog, Rana catesbeiana', "29": "axolotl, mud puppy, Ambystoma mexicanum",
31: 'tree frog, tree-frog', "30": "bullfrog, Rana catesbeiana",
32: 'tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui', "31": "tree frog, tree-frog",
33: 'loggerhead, loggerhead turtle, Caretta caretta', "32": "tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui",
34: 'leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea', "33": "loggerhead, loggerhead turtle, Caretta caretta",
35: 'mud turtle', "34": "leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea",
36: 'terrapin', "35": "mud turtle",
37: 'box turtle, box tortoise', "36": "terrapin",
38: 'banded gecko', "37": "box turtle, box tortoise",
39: 'common iguana, iguana, Iguana iguana', "38": "banded gecko",
40: 'American chameleon, anole, Anolis carolinensis', "39": "common iguana, iguana, Iguana iguana",
41: 'whiptail, whiptail lizard', "40": "American chameleon, anole, Anolis carolinensis",
42: 'agama', "41": "whiptail, whiptail lizard",
43: 'frilled lizard, Chlamydosaurus kingi', "42": "agama",
44: 'alligator lizard', "43": "frilled lizard, Chlamydosaurus kingi",
45: 'Gila monster, Heloderma suspectum', "44": "alligator lizard",
46: 'green lizard, Lacerta viridis', "45": "Gila monster, Heloderma suspectum",
47: 'African chameleon, Chamaeleo chamaeleon', "46": "green lizard, Lacerta viridis",
48: 'Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis', "47": "African chameleon, Chamaeleo chamaeleon",
49: 'African crocodile, Nile crocodile, Crocodylus niloticus', "48": "Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis",
50: 'American alligator, Alligator mississipiensis', "49": "African crocodile, Nile crocodile, Crocodylus niloticus",
51: 'triceratops', "50": "American alligator, Alligator mississipiensis",
52: 'thunder snake, worm snake, Carphophis amoenus', "51": "triceratops",
53: 'ringneck snake, ring-necked snake, ring snake', "52": "thunder snake, worm snake, Carphophis amoenus",
54: 'hognose snake, puff adder, sand viper', "53": "ringneck snake, ring-necked snake, ring snake",
55: 'green snake, grass snake', "54": "hognose snake, puff adder, sand viper",
56: 'king snake, kingsnake', "55": "green snake, grass snake",
57: 'garter snake, grass snake', "56": "king snake, kingsnake",
58: 'water snake', "57": "garter snake, grass snake",
59: 'vine snake', "58": "water snake",
60: 'night snake, Hypsiglena torquata', "59": "vine snake",
61: 'boa constrictor, Constrictor constrictor', "60": "night snake, Hypsiglena torquata",
62: 'rock python, rock snake, Python sebae', "61": "boa constrictor, Constrictor constrictor",
63: 'Indian cobra, Naja naja', "62": "rock python, rock snake, Python sebae",
64: 'green mamba', "63": "Indian cobra, Naja naja",
65: 'sea snake', "64": "green mamba",
66: 'horned viper, cerastes, sand viper, horned asp, Cerastes cornutus', "65": "sea snake",
67: 'diamondback, diamondback rattlesnake, Crotalus adamanteus', "66": "horned viper, cerastes, sand viper, horned asp, Cerastes cornutus",
68: 'sidewinder, horned rattlesnake, Crotalus cerastes', "67": "diamondback, diamondback rattlesnake, Crotalus adamanteus",
69: 'trilobite', "68": "sidewinder, horned rattlesnake, Crotalus cerastes",
70: 'harvestman, daddy longlegs, Phalangium opilio', "69": "trilobite",
71: 'scorpion', "70": "harvestman, daddy longlegs, Phalangium opilio",
72: 'black and gold garden spider, Argiope aurantia', "71": "scorpion",
73: 'barn spider, Araneus cavaticus', "72": "black and gold garden spider, Argiope aurantia",
74: 'garden spider, Aranea diademata', "73": "barn spider, Araneus cavaticus",
75: 'black widow, Latrodectus mactans', "74": "garden spider, Aranea diademata",
76: 'tarantula', "75": "black widow, Latrodectus mactans",
77: 'wolf spider, hunting spider', "76": "tarantula",
78: 'tick', "77": "wolf spider, hunting spider",
79: 'centipede', "78": "tick",
80: 'black grouse', "79": "centipede",
81: 'ptarmigan', "80": "black grouse",
82: 'ruffed grouse, partridge, Bonasa umbellus', "81": "ptarmigan",
83: 'prairie chicken, prairie grouse, prairie fowl', "82": "ruffed grouse, partridge, Bonasa umbellus",
84: 'peacock', "83": "prairie chicken, prairie grouse, prairie fowl",
85: 'quail', "84": "peacock",
86: 'partridge', "85": "quail",
87: 'African grey, African gray, Psittacus erithacus', "86": "partridge",
88: 'macaw', "87": "African grey, African gray, Psittacus erithacus",
89: 'sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita', "88": "macaw",
90: 'lorikeet', "89": "sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita",
91: 'coucal', "90": "lorikeet",
92: 'bee eater', "91": "coucal",
93: 'hornbill', "92": "bee eater",
94: 'hummingbird', "93": "hornbill",
95: 'jacamar', "94": "hummingbird",
96: 'toucan', "95": "jacamar",
97: 'drake', "96": "toucan",
98: 'red-breasted merganser, Mergus serrator', "97": "drake",
99: 'goose', "98": "red-breasted merganser, Mergus serrator",
100: 'black swan, Cygnus atratus', "99": "goose",
101: 'tusker', "100": "black swan, Cygnus atratus",
102: 'echidna, spiny anteater, anteater', "101": "tusker",
103: 'platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus', "102": "echidna, spiny anteater, anteater",
104: 'wallaby, brush kangaroo', "103": "platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus",
105: 'koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus', "104": "wallaby, brush kangaroo",
106: 'wombat', "105": "koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus",
107: 'jellyfish', "106": "wombat",
108: 'sea anemone, anemone', "107": "jellyfish",
109: 'brain coral', "108": "sea anemone, anemone",
110: 'flatworm, platyhelminth', "109": "brain coral",
111: 'nematode, nematode worm, roundworm', "110": "flatworm, platyhelminth",
112: 'conch', "111": "nematode, nematode worm, roundworm",
113: 'snail', "112": "conch",
114: 'slug', "113": "snail",
115: 'sea slug, nudibranch', "114": "slug",
116: 'chiton, coat-of-mail shell, sea cradle, polyplacophore', "115": "sea slug, nudibranch",
117: 'chambered nautilus, pearly nautilus, nautilus', "116": "chiton, coat-of-mail shell, sea cradle, polyplacophore",
118: 'Dungeness crab, Cancer magister', "117": "chambered nautilus, pearly nautilus, nautilus",
119: 'rock crab, Cancer irroratus', "118": "Dungeness crab, Cancer magister",
120: 'fiddler crab', "119": "rock crab, Cancer irroratus",
121: 'king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica', "120": "fiddler crab",
122: 'American lobster, Northern lobster, Maine lobster, Homarus americanus', "121": "king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica",
123: 'spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish', "122": "American lobster, Northern lobster, Maine lobster, Homarus americanus",
124: 'crayfish, crawfish, crawdad, crawdaddy', "123": "spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish",
125: 'hermit crab', "124": "crayfish, crawfish, crawdad, crawdaddy",
126: 'isopod', "125": "hermit crab",
127: 'white stork, Ciconia ciconia', "126": "isopod",
128: 'black stork, Ciconia nigra', "127": "white stork, Ciconia ciconia",
129: 'spoonbill', "128": "black stork, Ciconia nigra",
130: 'flamingo', "129": "spoonbill",
131: 'little blue heron, Egretta caerulea', "130": "flamingo",
132: 'American egret, great white heron, Egretta albus', "131": "little blue heron, Egretta caerulea",
133: 'bittern', "132": "American egret, great white heron, Egretta albus",
134: 'crane', "133": "bittern",
135: 'limpkin, Aramus pictus', "134": "crane",
136: 'European gallinule, Porphyrio porphyrio', "135": "limpkin, Aramus pictus",
137: 'American coot, marsh hen, mud hen, water hen, Fulica americana', "136": "European gallinule, Porphyrio porphyrio",
138: 'bustard', "137": "American coot, marsh hen, mud hen, water hen, Fulica americana",
139: 'ruddy turnstone, Arenaria interpres', "138": "bustard",
140: 'red-backed sandpiper, dunlin, Erolia alpina', "139": "ruddy turnstone, Arenaria interpres",
141: 'redshank, Tringa totanus', "140": "red-backed sandpiper, dunlin, Erolia alpina",
142: 'dowitcher', "141": "redshank, Tringa totanus",
143: 'oystercatcher, oyster catcher', "142": "dowitcher",
144: 'pelican', "143": "oystercatcher, oyster catcher",
145: 'king penguin, Aptenodytes patagonica', "144": "pelican",
146: 'albatross, mollymawk', "145": "king penguin, Aptenodytes patagonica",
147: 'grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus', "146": "albatross, mollymawk",
148: 'killer whale, killer, orca, grampus, sea wolf, Orcinus orca', "147": "grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus",
149: 'dugong, Dugong dugon', "148": "killer whale, killer, orca, grampus, sea wolf, Orcinus orca",
150: 'sea lion', "149": "dugong, Dugong dugon",
151: 'Chihuahua', "150": "sea lion",
152: 'Japanese spaniel', "151": "Chihuahua",
153: 'Maltese dog, Maltese terrier, Maltese', "152": "Japanese spaniel",
154: 'Pekinese, Pekingese, Peke', "153": "Maltese dog, Maltese terrier, Maltese",
155: 'Shih-Tzu', "154": "Pekinese, Pekingese, Peke",
156: 'Blenheim spaniel', "155": "Shih-Tzu",
157: 'papillon', "156": "Blenheim spaniel",
158: 'toy terrier', "157": "papillon",
159: 'Rhodesian ridgeback', "158": "toy terrier",
160: 'Afghan hound, Afghan', "159": "Rhodesian ridgeback",
161: 'basset, basset hound', "160": "Afghan hound, Afghan",
162: 'beagle', "161": "basset, basset hound",
163: 'bloodhound, sleuthhound', "162": "beagle",
164: 'bluetick', "163": "bloodhound, sleuthhound",
165: 'black-and-tan coonhound', "164": "bluetick",
166: 'Walker hound, Walker foxhound', "165": "black-and-tan coonhound",
167: 'English foxhound', "166": "Walker hound, Walker foxhound",
168: 'redbone', "167": "English foxhound",
169: 'borzoi, Russian wolfhound', "168": "redbone",
170: 'Irish wolfhound', "169": "borzoi, Russian wolfhound",
171: 'Italian greyhound', "170": "Irish wolfhound",
172: 'whippet', "171": "Italian greyhound",
173: 'Ibizan hound, Ibizan Podenco', "172": "whippet",
174: 'Norwegian elkhound, elkhound', "173": "Ibizan hound, Ibizan Podenco",
175: 'otterhound, otter hound', "174": "Norwegian elkhound, elkhound",
176: 'Saluki, gazelle hound', "175": "otterhound, otter hound",
177: 'Scottish deerhound, deerhound', "176": "Saluki, gazelle hound",
178: 'Weimaraner', "177": "Scottish deerhound, deerhound",
179: 'Staffordshire bullterrier, Staffordshire bull terrier', "178": "Weimaraner",
180: 'American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier', "179": "Staffordshire bullterrier, Staffordshire bull terrier",
181: 'Bedlington terrier', "180": "American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier",
182: 'Border terrier', "181": "Bedlington terrier",
183: 'Kerry blue terrier', "182": "Border terrier",
184: 'Irish terrier', "183": "Kerry blue terrier",
185: 'Norfolk terrier', "184": "Irish terrier",
186: 'Norwich terrier', "185": "Norfolk terrier",
187: 'Yorkshire terrier', "186": "Norwich terrier",
188: 'wire-haired fox terrier', "187": "Yorkshire terrier",
189: 'Lakeland terrier', "188": "wire-haired fox terrier",
190: 'Sealyham terrier, Sealyham', "189": "Lakeland terrier",
191: 'Airedale, Airedale terrier', "190": "Sealyham terrier, Sealyham",
192: 'cairn, cairn terrier', "191": "Airedale, Airedale terrier",
193: 'Australian terrier', "192": "cairn, cairn terrier",
194: 'Dandie Dinmont, Dandie Dinmont terrier', "193": "Australian terrier",
195: 'Boston bull, Boston terrier', "194": "Dandie Dinmont, Dandie Dinmont terrier",
196: 'miniature schnauzer', "195": "Boston bull, Boston terrier",
197: 'giant schnauzer', "196": "miniature schnauzer",
198: 'standard schnauzer', "197": "giant schnauzer",
199: 'Scotch terrier, Scottish terrier, Scottie', "198": "standard schnauzer",
200: 'Tibetan terrier, chrysanthemum dog', "199": "Scotch terrier, Scottish terrier, Scottie",
201: 'silky terrier, Sydney silky', "200": "Tibetan terrier, chrysanthemum dog",
202: 'soft-coated wheaten terrier', "201": "silky terrier, Sydney silky",
203: 'West Highland white terrier', "202": "soft-coated wheaten terrier",
204: 'Lhasa, Lhasa apso', "203": "West Highland white terrier",
205: 'flat-coated retriever', "204": "Lhasa, Lhasa apso",
206: 'curly-coated retriever', "205": "flat-coated retriever",
207: 'golden retriever', "206": "curly-coated retriever",
208: 'Labrador retriever', "207": "golden retriever",
209: 'Chesapeake Bay retriever', "208": "Labrador retriever",
210: 'German short-haired pointer', "209": "Chesapeake Bay retriever",
211: 'vizsla, Hungarian pointer', "210": "German short-haired pointer",
212: 'English setter', "211": "vizsla, Hungarian pointer",
213: 'Irish setter, red setter', "212": "English setter",
214: 'Gordon setter', "213": "Irish setter, red setter",
215: 'Brittany spaniel', "214": "Gordon setter",
216: 'clumber, clumber spaniel', "215": "Brittany spaniel",
217: 'English springer, English springer spaniel', "216": "clumber, clumber spaniel",
218: 'Welsh springer spaniel', "217": "English springer, English springer spaniel",
219: 'cocker spaniel, English cocker spaniel, cocker', "218": "Welsh springer spaniel",
220: 'Sussex spaniel', "219": "cocker spaniel, English cocker spaniel, cocker",
221: 'Irish water spaniel', "220": "Sussex spaniel",
222: 'kuvasz', "221": "Irish water spaniel",
223: 'schipperke', "222": "kuvasz",
224: 'groenendael', "223": "schipperke",
225: 'malinois', "224": "groenendael",
226: 'briard', "225": "malinois",
227: 'kelpie', "226": "briard",
228: 'komondor', "227": "kelpie",
229: 'Old English sheepdog, bobtail', "228": "komondor",
230: 'Shetland sheepdog, Shetland sheep dog, Shetland', "229": "Old English sheepdog, bobtail",
231: 'collie', "230": "Shetland sheepdog, Shetland sheep dog, Shetland",
232: 'Border collie', "231": "collie",
233: 'Bouvier des Flandres, Bouviers des Flandres', "232": "Border collie",
234: 'Rottweiler', "233": "Bouvier des Flandres, Bouviers des Flandres",
235: 'German shepherd, German shepherd dog, German police dog, alsatian', "234": "Rottweiler",
236: 'Doberman, Doberman pinscher', "235": "German shepherd, German shepherd dog, German police dog, alsatian",
237: 'miniature pinscher', "236": "Doberman, Doberman pinscher",
238: 'Greater Swiss Mountain dog', "237": "miniature pinscher",
239: 'Bernese mountain dog', "238": "Greater Swiss Mountain dog",
240: 'Appenzeller', "239": "Bernese mountain dog",
241: 'EntleBucher', "240": "Appenzeller",
242: 'boxer', "241": "EntleBucher",
243: 'bull mastiff', "242": "boxer",
244: 'Tibetan mastiff', "243": "bull mastiff",
245: 'French bulldog', "244": "Tibetan mastiff",
246: 'Great Dane', "245": "French bulldog",
247: 'Saint Bernard, St Bernard', "246": "Great Dane",
248: 'Eskimo dog, husky', "247": "Saint Bernard, St Bernard",
249: 'malamute, malemute, Alaskan malamute', "248": "Eskimo dog, husky",
250: 'Siberian husky', "249": "malamute, malemute, Alaskan malamute",
251: 'dalmatian, coach dog, carriage dog', "250": "Siberian husky",
252: 'affenpinscher, monkey pinscher, monkey dog', "251": "dalmatian, coach dog, carriage dog",
253: 'basenji', "252": "affenpinscher, monkey pinscher, monkey dog",
254: 'pug, pug-dog', "253": "basenji",
255: 'Leonberg', "254": "pug, pug-dog",
256: 'Newfoundland, Newfoundland dog', "255": "Leonberg",
257: 'Great Pyrenees', "256": "Newfoundland, Newfoundland dog",
258: 'Samoyed, Samoyede', "257": "Great Pyrenees",
259: 'Pomeranian', "258": "Samoyed, Samoyede",
260: 'chow, chow chow', "259": "Pomeranian",
261: 'keeshond', "260": "chow, chow chow",
262: 'Brabancon griffon', "261": "keeshond",
263: 'Pembroke, Pembroke Welsh corgi', "262": "Brabancon griffon",
264: 'Cardigan, Cardigan Welsh corgi', "263": "Pembroke, Pembroke Welsh corgi",
265: 'toy poodle', "264": "Cardigan, Cardigan Welsh corgi",
266: 'miniature poodle', "265": "toy poodle",
267: 'standard poodle', "266": "miniature poodle",
268: 'Mexican hairless', "267": "standard poodle",
269: 'timber wolf, grey wolf, gray wolf, Canis lupus', "268": "Mexican hairless",
270: 'white wolf, Arctic wolf, Canis lupus tundrarum', "269": "timber wolf, grey wolf, gray wolf, Canis lupus",
271: 'red wolf, maned wolf, Canis rufus, Canis niger', "270": "white wolf, Arctic wolf, Canis lupus tundrarum",
272: 'coyote, prairie wolf, brush wolf, Canis latrans', "271": "red wolf, maned wolf, Canis rufus, Canis niger",
273: 'dingo, warrigal, warragal, Canis dingo', "272": "coyote, prairie wolf, brush wolf, Canis latrans",
274: 'dhole, Cuon alpinus', "273": "dingo, warrigal, warragal, Canis dingo",
275: 'African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus', "274": "dhole, Cuon alpinus",
276: 'hyena, hyaena', "275": "African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus",
277: 'red fox, Vulpes vulpes', "276": "hyena, hyaena",
278: 'kit fox, Vulpes macrotis', "277": "red fox, Vulpes vulpes",
279: 'Arctic fox, white fox, Alopex lagopus', "278": "kit fox, Vulpes macrotis",
280: 'grey fox, gray fox, Urocyon cinereoargenteus', "279": "Arctic fox, white fox, Alopex lagopus",
281: 'tabby, tabby cat', "280": "grey fox, gray fox, Urocyon cinereoargenteus",
282: 'tiger cat', "281": "tabby, tabby cat",
283: 'Persian cat', "282": "tiger cat",
284: 'Siamese cat, Siamese', "283": "Persian cat",
285: 'Egyptian cat', "284": "Siamese cat, Siamese",
286: 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor', "285": "Egyptian cat",
287: 'lynx, catamount', "286": "cougar, puma, catamount, mountain lion, painter, panther, Felis concolor",
288: 'leopard, Panthera pardus', "287": "lynx, catamount",
289: 'snow leopard, ounce, Panthera uncia', "288": "leopard, Panthera pardus",
290: 'jaguar, panther, Panthera onca, Felis onca', "289": "snow leopard, ounce, Panthera uncia",
291: 'lion, king of beasts, Panthera leo', "290": "jaguar, panther, Panthera onca, Felis onca",
292: 'tiger, Panthera tigris', "291": "lion, king of beasts, Panthera leo",
293: 'cheetah, chetah, Acinonyx jubatus', "292": "tiger, Panthera tigris",
294: 'brown bear, bruin, Ursus arctos', "293": "cheetah, chetah, Acinonyx jubatus",
295: 'American black bear, black bear, Ursus americanus, Euarctos americanus', "294": "brown bear, bruin, Ursus arctos",
296: 'ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus', "295": "American black bear, black bear, Ursus americanus, Euarctos americanus",
297: 'sloth bear, Melursus ursinus, Ursus ursinus', "296": "ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus",
298: 'mongoose', "297": "sloth bear, Melursus ursinus, Ursus ursinus",
299: 'meerkat, mierkat', "298": "mongoose",
300: 'tiger beetle', "299": "meerkat, mierkat",
301: 'ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle', "300": "tiger beetle",
302: 'ground beetle, carabid beetle', "301": "ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle",
303: 'long-horned beetle, longicorn, longicorn beetle', "302": "ground beetle, carabid beetle",
304: 'leaf beetle, chrysomelid', "303": "long-horned beetle, longicorn, longicorn beetle",
305: 'dung beetle', "304": "leaf beetle, chrysomelid",
306: 'rhinoceros beetle', "305": "dung beetle",
307: 'weevil', "306": "rhinoceros beetle",
308: 'fly', "307": "weevil",
309: 'bee', "308": "fly",
310: 'ant, emmet, pismire', "309": "bee",
311: 'grasshopper, hopper', "310": "ant, emmet, pismire",
312: 'cricket', "311": "grasshopper, hopper",
313: 'walking stick, walkingstick, stick insect', "312": "cricket",
314: 'cockroach, roach', "313": "walking stick, walkingstick, stick insect",
315: 'mantis, mantid', "314": "cockroach, roach",
316: 'cicada, cicala', "315": "mantis, mantid",
317: 'leafhopper', "316": "cicada, cicala",
318: 'lacewing, lacewing fly', "317": "leafhopper",
319: "dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk", "318": "lacewing, lacewing fly",
320: 'damselfly', "319": "dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk",
321: 'admiral', "320": "damselfly",
322: 'ringlet, ringlet butterfly', "321": "admiral",
323: 'monarch, monarch butterfly, milkweed butterfly, Danaus plexippus', "322": "ringlet, ringlet butterfly",
324: 'cabbage butterfly', "323": "monarch, monarch butterfly, milkweed butterfly, Danaus plexippus",
325: 'sulphur butterfly, sulfur butterfly', "324": "cabbage butterfly",
326: 'lycaenid, lycaenid butterfly', "325": "sulphur butterfly, sulfur butterfly",
327: 'starfish, sea star', "326": "lycaenid, lycaenid butterfly",
328: 'sea urchin', "327": "starfish, sea star",
329: 'sea cucumber, holothurian', "328": "sea urchin",
330: 'wood rabbit, cottontail, cottontail rabbit', "329": "sea cucumber, holothurian",
331: 'hare', "330": "wood rabbit, cottontail, cottontail rabbit",
332: 'Angora, Angora rabbit', "331": "hare",
333: 'hamster', "332": "Angora, Angora rabbit",
334: 'porcupine, hedgehog', "333": "hamster",
335: 'fox squirrel, eastern fox squirrel, Sciurus niger', "334": "porcupine, hedgehog",
336: 'marmot', "335": "fox squirrel, eastern fox squirrel, Sciurus niger",
337: 'beaver', "336": "marmot",
338: 'guinea pig, Cavia cobaya', "337": "beaver",
339: 'sorrel', "338": "guinea pig, Cavia cobaya",
340: 'zebra', "339": "sorrel",
341: 'hog, pig, grunter, squealer, Sus scrofa', "340": "zebra",
342: 'wild boar, boar, Sus scrofa', "341": "hog, pig, grunter, squealer, Sus scrofa",
343: 'warthog', "342": "wild boar, boar, Sus scrofa",
344: 'hippopotamus, hippo, river horse, Hippopotamus amphibius', "343": "warthog",
345: 'ox', "344": "hippopotamus, hippo, river horse, Hippopotamus amphibius",
346: 'water buffalo, water ox, Asiatic buffalo, Bubalus bubalis', "345": "ox",
347: 'bison', "346": "water buffalo, water ox, Asiatic buffalo, Bubalus bubalis",
348: 'ram, tup', "347": "bison",
349: 'bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis', "348": "ram, tup",
350: 'ibex, Capra ibex', "349": "bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis",
351: 'hartebeest', "350": "ibex, Capra ibex",
352: 'impala, Aepyceros melampus', "351": "hartebeest",
353: 'gazelle', "352": "impala, Aepyceros melampus",
354: 'Arabian camel, dromedary, Camelus dromedarius', "353": "gazelle",
355: 'llama', "354": "Arabian camel, dromedary, Camelus dromedarius",
356: 'weasel', "355": "llama",
357: 'mink', "356": "weasel",
358: 'polecat, fitch, foulmart, foumart, Mustela putorius', "357": "mink",
359: 'black-footed ferret, ferret, Mustela nigripes', "358": "polecat, fitch, foulmart, foumart, Mustela putorius",
360: 'otter', "359": "black-footed ferret, ferret, Mustela nigripes",
361: 'skunk, polecat, wood pussy', "360": "otter",
362: 'badger', "361": "skunk, polecat, wood pussy",
363: 'armadillo', "362": "badger",
364: 'three-toed sloth, ai, Bradypus tridactylus', "363": "armadillo",
365: 'orangutan, orang, orangutang, Pongo pygmaeus', "364": "three-toed sloth, ai, Bradypus tridactylus",
366: 'gorilla, Gorilla gorilla', "365": "orangutan, orang, orangutang, Pongo pygmaeus",
367: 'chimpanzee, chimp, Pan troglodytes', "366": "gorilla, Gorilla gorilla",
368: 'gibbon, Hylobates lar', "367": "chimpanzee, chimp, Pan troglodytes",
369: 'siamang, Hylobates syndactylus, Symphalangus syndactylus', "368": "gibbon, Hylobates lar",
370: 'guenon, guenon monkey', "369": "siamang, Hylobates syndactylus, Symphalangus syndactylus",
371: 'patas, hussar monkey, Erythrocebus patas', "370": "guenon, guenon monkey",
372: 'baboon', "371": "patas, hussar monkey, Erythrocebus patas",
373: 'macaque', "372": "baboon",
374: 'langur', "373": "macaque",
375: 'colobus, colobus monkey', "374": "langur",
376: 'proboscis monkey, Nasalis larvatus', "375": "colobus, colobus monkey",
377: 'marmoset', "376": "proboscis monkey, Nasalis larvatus",
378: 'capuchin, ringtail, Cebus capucinus', "377": "marmoset",
379: 'howler monkey, howler', "378": "capuchin, ringtail, Cebus capucinus",
380: 'titi, titi monkey', "379": "howler monkey, howler",
381: 'spider monkey, Ateles geoffroyi', "380": "titi, titi monkey",
382: 'squirrel monkey, Saimiri sciureus', "381": "spider monkey, Ateles geoffroyi",
383: 'Madagascar cat, ring-tailed lemur, Lemur catta', "382": "squirrel monkey, Saimiri sciureus",
384: 'indri, indris, Indri indri, Indri brevicaudatus', "383": "Madagascar cat, ring-tailed lemur, Lemur catta",
385: 'Indian elephant, Elephas maximus', "384": "indri, indris, Indri indri, Indri brevicaudatus",
386: 'African elephant, Loxodonta africana', "385": "Indian elephant, Elephas maximus",
387: 'lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens', "386": "African elephant, Loxodonta africana",
388: 'giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca', "387": "lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens",
389: 'barracouta, snoek', "388": "giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca",
390: 'eel', "389": "barracouta, snoek",
391: 'coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch', "390": "eel",
392: 'rock beauty, Holocanthus tricolor', "391": "coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch",
393: 'anemone fish', "392": "rock beauty, Holocanthus tricolor",
394: 'sturgeon', "393": "anemone fish",
395: 'gar, garfish, garpike, billfish, Lepisosteus osseus', "394": "sturgeon",
396: 'lionfish', "395": "gar, garfish, garpike, billfish, Lepisosteus osseus",
397: 'puffer, pufferfish, blowfish, globefish', "396": "lionfish",
398: 'abacus', "397": "puffer, pufferfish, blowfish, globefish",
399: 'abaya', "398": "abacus",
400: "academic gown, academic robe, judge's robe", "399": "abaya",
401: 'accordion, piano accordion, squeeze box', "400": "academic gown, academic robe, judge's robe",
402: 'acoustic guitar', "401": "accordion, piano accordion, squeeze box",
403: 'aircraft carrier, carrier, flattop, attack aircraft carrier', "402": "acoustic guitar",
404: 'airliner', "403": "aircraft carrier, carrier, flattop, attack aircraft carrier",
405: 'airship, dirigible', "404": "airliner",
406: 'altar', "405": "airship, dirigible",
407: 'ambulance', "406": "altar",
408: 'amphibian, amphibious vehicle', "407": "ambulance",
409: 'analog clock', "408": "amphibian, amphibious vehicle",
410: 'apiary, bee house', "409": "analog clock",
411: 'apron', "410": "apiary, bee house",
412: 'ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin', "411": "apron",
413: 'assault rifle, assault gun', "412": "ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin",
414: 'backpack, back pack, knapsack, packsack, rucksack, haversack', "413": "assault rifle, assault gun",
415: 'bakery, bakeshop, bakehouse', "414": "backpack, back pack, knapsack, packsack, rucksack, haversack",
416: 'balance beam, beam', "415": "bakery, bakeshop, bakehouse",
417: 'balloon', "416": "balance beam, beam",
418: 'ballpoint, ballpoint pen, ballpen, Biro', "417": "balloon",
419: 'Band Aid', "418": "ballpoint, ballpoint pen, ballpen, Biro",
420: 'banjo', "419": "Band Aid",
421: 'bannister, banister, balustrade, balusters, handrail', "420": "banjo",
422: 'barbell', "421": "bannister, banister, balustrade, balusters, handrail",
423: 'barber chair', "422": "barbell",
424: 'barbershop', "423": "barber chair",
425: 'barn', "424": "barbershop",
426: 'barometer', "425": "barn",
427: 'barrel, cask', "426": "barometer",
428: 'barrow, garden cart, lawn cart, wheelbarrow', "427": "barrel, cask",
429: 'baseball', "428": "barrow, garden cart, lawn cart, wheelbarrow",
430: 'basketball', "429": "baseball",
431: 'bassinet', "430": "basketball",
432: 'bassoon', "431": "bassinet",
433: 'bathing cap, swimming cap', "432": "bassoon",
434: 'bath towel', "433": "bathing cap, swimming cap",
435: 'bathtub, bathing tub, bath, tub', "434": "bath towel",
436: 'beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon', "435": "bathtub, bathing tub, bath, tub",
437: 'beacon, lighthouse, beacon light, pharos', "436": "beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon",
438: 'beaker', "437": "beacon, lighthouse, beacon light, pharos",
439: 'bearskin, busby, shako', "438": "beaker",
440: 'beer bottle', "439": "bearskin, busby, shako",
441: 'beer glass', "440": "beer bottle",
442: 'bell cote, bell cot', "441": "beer glass",
443: 'bib', "442": "bell cote, bell cot",
444: 'bicycle-built-for-two, tandem bicycle, tandem', "443": "bib",
445: 'bikini, two-piece', "444": "bicycle-built-for-two, tandem bicycle, tandem",
446: 'binder, ring-binder', "445": "bikini, two-piece",
447: 'binoculars, field glasses, opera glasses', "446": "binder, ring-binder",
448: 'birdhouse', "447": "binoculars, field glasses, opera glasses",
449: 'boathouse', "448": "birdhouse",
450: 'bobsled, bobsleigh, bob', "449": "boathouse",
451: 'bolo tie, bolo, bola tie, bola', "450": "bobsled, bobsleigh, bob",
452: 'bonnet, poke bonnet', "451": "bolo tie, bolo, bola tie, bola",
453: 'bookcase', "452": "bonnet, poke bonnet",
454: 'bookshop, bookstore, bookstall', "453": "bookcase",
455: 'bottlecap', "454": "bookshop, bookstore, bookstall",
456: 'bow', "455": "bottlecap",
457: 'bow tie, bow-tie, bowtie', "456": "bow",
458: 'brass, memorial tablet, plaque', "457": "bow tie, bow-tie, bowtie",
459: 'brassiere, bra, bandeau', "458": "brass, memorial tablet, plaque",
460: 'breakwater, groin, groyne, mole, bulwark, seawall, jetty', "459": "brassiere, bra, bandeau",
461: 'breastplate, aegis, egis', "460": "breakwater, groin, groyne, mole, bulwark, seawall, jetty",
462: 'broom', "461": "breastplate, aegis, egis",
463: 'bucket, pail', "462": "broom",
464: 'buckle', "463": "bucket, pail",
465: 'bulletproof vest', "464": "buckle",
466: 'bullet train, bullet', "465": "bulletproof vest",
467: 'butcher shop, meat market', "466": "bullet train, bullet",
468: 'cab, hack, taxi, taxicab', "467": "butcher shop, meat market",
469: 'caldron, cauldron', "468": "cab, hack, taxi, taxicab",
470: 'candle, taper, wax light', "469": "caldron, cauldron",
471: 'cannon', "470": "candle, taper, wax light",
472: 'canoe', "471": "cannon",
473: 'can opener, tin opener', "472": "canoe",
474: 'cardigan', "473": "can opener, tin opener",
475: 'car mirror', "474": "cardigan",
476: 'carousel, carrousel, merry-go-round, roundabout, whirligig', "475": "car mirror",
477: "carpenter's kit, tool kit", "476": "carousel, carrousel, merry-go-round, roundabout, whirligig",
478: 'carton', "477": "carpenter's kit, tool kit",
479: 'car wheel', "478": "carton",
480: 'cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM', "479": "car wheel",
481: 'cassette', "480": "cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM",
482: 'cassette player', "481": "cassette",
483: 'castle', "482": "cassette player",
484: 'catamaran', "483": "castle",
485: 'CD player', "484": "catamaran",
486: 'cello, violoncello', "485": "CD player",
487: 'cellular telephone, cellular phone, cellphone, cell, mobile phone', "486": "cello, violoncello",
488: 'chain', "487": "cellular telephone, cellular phone, cellphone, cell, mobile phone",
489: 'chainlink fence', "488": "chain",
490: 'chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour', "489": "chainlink fence",
491: 'chain saw, chainsaw', "490": "chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour",
492: 'chest', "491": "chain saw, chainsaw",
493: 'chiffonier, commode', "492": "chest",
494: 'chime, bell, gong', "493": "chiffonier, commode",
495: 'china cabinet, china closet', "494": "chime, bell, gong",
496: 'Christmas stocking', "495": "china cabinet, china closet",
497: 'church, church building', "496": "Christmas stocking",
498: 'cinema, movie theater, movie theatre, movie house, picture palace', "497": "church, church building",
499: 'cleaver, meat cleaver, chopper', "498": "cinema, movie theater, movie theatre, movie house, picture palace",
500: 'cliff dwelling', "499": "cleaver, meat cleaver, chopper",
501: 'cloak', "500": "cliff dwelling",
502: 'clog, geta, patten, sabot', "501": "cloak",
503: 'cocktail shaker', "502": "clog, geta, patten, sabot",
504: 'coffee mug', "503": "cocktail shaker",
505: 'coffeepot', "504": "coffee mug",
506: 'coil, spiral, volute, whorl, helix', "505": "coffeepot",
507: 'combination lock', "506": "coil, spiral, volute, whorl, helix",
508: 'computer keyboard, keypad', "507": "combination lock",
509: 'confectionery, confectionary, candy store', "508": "computer keyboard, keypad",
510: 'container ship, containership, container vessel', "509": "confectionery, confectionary, candy store",
511: 'convertible', "510": "container ship, containership, container vessel",
512: 'corkscrew, bottle screw', "511": "convertible",
513: 'cornet, horn, trumpet, trump', "512": "corkscrew, bottle screw",
514: 'cowboy boot', "513": "cornet, horn, trumpet, trump",
515: 'cowboy hat, ten-gallon hat', "514": "cowboy boot",
516: 'cradle', "515": "cowboy hat, ten-gallon hat",
517: 'crane', "516": "cradle",
518: 'crash helmet', "517": "crane",
519: 'crate', "518": "crash helmet",
520: 'crib, cot', "519": "crate",
521: 'Crock Pot', "520": "crib, cot",
522: 'croquet ball', "521": "Crock Pot",
523: 'crutch', "522": "croquet ball",
524: 'cuirass', "523": "crutch",
525: 'dam, dike, dyke', "524": "cuirass",
526: 'desk', "525": "dam, dike, dyke",
527: 'desktop computer', "526": "desk",
528: 'dial telephone, dial phone', "527": "desktop computer",
529: 'diaper, nappy, napkin', "528": "dial telephone, dial phone",
530: 'digital clock', "529": "diaper, nappy, napkin",
531: 'digital watch', "530": "digital clock",
532: 'dining table, board', "531": "digital watch",
533: 'dishrag, dishcloth', "532": "dining table, board",
534: 'dishwasher, dish washer, dishwashing machine', "533": "dishrag, dishcloth",
535: 'disk brake, disc brake', "534": "dishwasher, dish washer, dishwashing machine",
536: 'dock, dockage, docking facility', "535": "disk brake, disc brake",
537: 'dogsled, dog sled, dog sleigh', "536": "dock, dockage, docking facility",
538: 'dome', "537": "dogsled, dog sled, dog sleigh",
539: 'doormat, welcome mat', "538": "dome",
540: 'drilling platform, offshore rig', "539": "doormat, welcome mat",
541: 'drum, membranophone, tympan', "540": "drilling platform, offshore rig",
542: 'drumstick', "541": "drum, membranophone, tympan",
543: 'dumbbell', "542": "drumstick",
544: 'Dutch oven', "543": "dumbbell",
545: 'electric fan, blower', "544": "Dutch oven",
546: 'electric guitar', "545": "electric fan, blower",
547: 'electric locomotive', "546": "electric guitar",
548: 'entertainment center', "547": "electric locomotive",
549: 'envelope', "548": "entertainment center",
550: 'espresso maker', "549": "envelope",
551: 'face powder', "550": "espresso maker",
552: 'feather boa, boa', "551": "face powder",
553: 'file, file cabinet, filing cabinet', "552": "feather boa, boa",
554: 'fireboat', "553": "file, file cabinet, filing cabinet",
555: 'fire engine, fire truck', "554": "fireboat",
556: 'fire screen, fireguard', "555": "fire engine, fire truck",
557: 'flagpole, flagstaff', "556": "fire screen, fireguard",
558: 'flute, transverse flute', "557": "flagpole, flagstaff",
559: 'folding chair', "558": "flute, transverse flute",
560: 'football helmet', "559": "folding chair",
561: 'forklift', "560": "football helmet",
562: 'fountain', "561": "forklift",
563: 'fountain pen', "562": "fountain",
564: 'four-poster', "563": "fountain pen",
565: 'freight car', "564": "four-poster",
566: 'French horn, horn', "565": "freight car",
567: 'frying pan, frypan, skillet', "566": "French horn, horn",
568: 'fur coat', "567": "frying pan, frypan, skillet",
569: 'garbage truck, dustcart', "568": "fur coat",
570: 'gasmask, respirator, gas helmet', "569": "garbage truck, dustcart",
571: 'gas pump, gasoline pump, petrol pump, island dispenser', "570": "gasmask, respirator, gas helmet",
572: 'goblet', "571": "gas pump, gasoline pump, petrol pump, island dispenser",
573: 'go-kart', "572": "goblet",
574: 'golf ball', "573": "go-kart",
575: 'golfcart, golf cart', "574": "golf ball",
576: 'gondola', "575": "golfcart, golf cart",
577: 'gong, tam-tam', "576": "gondola",
578: 'gown', "577": "gong, tam-tam",
579: 'grand piano, grand', "578": "gown",
580: 'greenhouse, nursery, glasshouse', "579": "grand piano, grand",
581: 'grille, radiator grille', "580": "greenhouse, nursery, glasshouse",
582: 'grocery store, grocery, food market, market', "581": "grille, radiator grille",
583: 'guillotine', "582": "grocery store, grocery, food market, market",
584: 'hair slide', "583": "guillotine",
585: 'hair spray', "584": "hair slide",
586: 'half track', "585": "hair spray",
587: 'hammer', "586": "half track",
588: 'hamper', "587": "hammer",
589: 'hand blower, blow dryer, blow drier, hair dryer, hair drier', "588": "hamper",
590: 'hand-held computer, hand-held microcomputer', "589": "hand blower, blow dryer, blow drier, hair dryer, hair drier",
591: 'handkerchief, hankie, hanky, hankey', "590": "hand-held computer, hand-held microcomputer",
592: 'hard disc, hard disk, fixed disk', "591": "handkerchief, hankie, hanky, hankey",
593: 'harmonica, mouth organ, harp, mouth harp', "592": "hard disc, hard disk, fixed disk",
594: 'harp', "593": "harmonica, mouth organ, harp, mouth harp",
595: 'harvester, reaper', "594": "harp",
596: 'hatchet', "595": "harvester, reaper",
597: 'holster', "596": "hatchet",
598: 'home theater, home theatre', "597": "holster",
599: 'honeycomb', "598": "home theater, home theatre",
600: 'hook, claw', "599": "honeycomb",
601: 'hoopskirt, crinoline', "600": "hook, claw",
602: 'horizontal bar, high bar', "601": "hoopskirt, crinoline",
603: 'horse cart, horse-cart', "602": "horizontal bar, high bar",
604: 'hourglass', "603": "horse cart, horse-cart",
605: 'iPod', "604": "hourglass",
606: 'iron, smoothing iron', "605": "iPod",
607: "jack-o'-lantern", "606": "iron, smoothing iron",
608: 'jean, blue jean, denim', "607": "jack-o'-lantern",
609: 'jeep, landrover', "608": "jean, blue jean, denim",
610: 'jersey, T-shirt, tee shirt', "609": "jeep, landrover",
611: 'jigsaw puzzle', "610": "jersey, T-shirt, tee shirt",
612: 'jinrikisha, ricksha, rickshaw', "611": "jigsaw puzzle",
613: 'joystick', "612": "jinrikisha, ricksha, rickshaw",
614: 'kimono', "613": "joystick",
615: 'knee pad', "614": "kimono",
616: 'knot', "615": "knee pad",
617: 'lab coat, laboratory coat', "616": "knot",
618: 'ladle', "617": "lab coat, laboratory coat",
619: 'lampshade, lamp shade', "618": "ladle",
620: 'laptop, laptop computer', "619": "lampshade, lamp shade",
621: 'lawn mower, mower', "620": "laptop, laptop computer",
622: 'lens cap, lens cover', "621": "lawn mower, mower",
623: 'letter opener, paper knife, paperknife', "622": "lens cap, lens cover",
624: 'library', "623": "letter opener, paper knife, paperknife",
625: 'lifeboat', "624": "library",
626: 'lighter, light, igniter, ignitor', "625": "lifeboat",
627: 'limousine, limo', "626": "lighter, light, igniter, ignitor",
628: 'liner, ocean liner', "627": "limousine, limo",
629: 'lipstick, lip rouge', "628": "liner, ocean liner",
630: 'Loafer', "629": "lipstick, lip rouge",
631: 'lotion', "630": "Loafer",
632: 'loudspeaker, speaker, speaker unit, loudspeaker system, speaker system', "631": "lotion",
633: "loupe, jeweler's loupe", "632": "loudspeaker, speaker, speaker unit, loudspeaker system, speaker system",
634: 'lumbermill, sawmill', "633": "loupe, jeweler's loupe",
635: 'magnetic compass', "634": "lumbermill, sawmill",
636: 'mailbag, postbag', "635": "magnetic compass",
637: 'mailbox, letter box', "636": "mailbag, postbag",
638: 'maillot', "637": "mailbox, letter box",
639: 'maillot, tank suit', "638": "maillot",
640: 'manhole cover', "639": "maillot, tank suit",
641: 'maraca', "640": "manhole cover",
642: 'marimba, xylophone', "641": "maraca",
643: 'mask', "642": "marimba, xylophone",
644: 'matchstick', "643": "mask",
645: 'maypole', "644": "matchstick",
646: 'maze, labyrinth', "645": "maypole",
647: 'measuring cup', "646": "maze, labyrinth",
648: 'medicine chest, medicine cabinet', "647": "measuring cup",
649: 'megalith, megalithic structure', "648": "medicine chest, medicine cabinet",
650: 'microphone, mike', "649": "megalith, megalithic structure",
651: 'microwave, microwave oven', "650": "microphone, mike",
652: 'military uniform', "651": "microwave, microwave oven",
653: 'milk can', "652": "military uniform",
654: 'minibus', "653": "milk can",
655: 'miniskirt, mini', "654": "minibus",
656: 'minivan', "655": "miniskirt, mini",
657: 'missile', "656": "minivan",
658: 'mitten', "657": "missile",
659: 'mixing bowl', "658": "mitten",
660: 'mobile home, manufactured home', "659": "mixing bowl",
661: 'Model T', "660": "mobile home, manufactured home",
662: 'modem', "661": "Model T",
663: 'monastery', "662": "modem",
664: 'monitor', "663": "monastery",
665: 'moped', "664": "monitor",
666: 'mortar', "665": "moped",
667: 'mortarboard', "666": "mortar",
668: 'mosque', "667": "mortarboard",
669: 'mosquito net', "668": "mosque",
670: 'motor scooter, scooter', "669": "mosquito net",
671: 'mountain bike, all-terrain bike, off-roader', "670": "motor scooter, scooter",
672: 'mountain tent', "671": "mountain bike, all-terrain bike, off-roader",
673: 'mouse, computer mouse', "672": "mountain tent",
674: 'mousetrap', "673": "mouse, computer mouse",
675: 'moving van', "674": "mousetrap",
676: 'muzzle', "675": "moving van",
677: 'nail', "676": "muzzle",
678: 'neck brace', "677": "nail",
679: 'necklace', "678": "neck brace",
680: 'nipple', "679": "necklace",
681: 'notebook, notebook computer', "680": "nipple",
682: 'obelisk', "681": "notebook, notebook computer",
683: 'oboe, hautboy, hautbois', "682": "obelisk",
684: 'ocarina, sweet potato', "683": "oboe, hautboy, hautbois",
685: 'odometer, hodometer, mileometer, milometer', "684": "ocarina, sweet potato",
686: 'oil filter', "685": "odometer, hodometer, mileometer, milometer",
687: 'organ, pipe organ', "686": "oil filter",
688: 'oscilloscope, scope, cathode-ray oscilloscope, CRO', "687": "organ, pipe organ",
689: 'overskirt', "688": "oscilloscope, scope, cathode-ray oscilloscope, CRO",
690: 'oxcart', "689": "overskirt",
691: 'oxygen mask', "690": "oxcart",
692: 'packet', "691": "oxygen mask",
693: 'paddle, boat paddle', "692": "packet",
694: 'paddlewheel, paddle wheel', "693": "paddle, boat paddle",
695: 'padlock', "694": "paddlewheel, paddle wheel",
696: 'paintbrush', "695": "padlock",
697: "pajama, pyjama, pj's, jammies", "696": "paintbrush",
698: 'palace', "697": "pajama, pyjama, pj's, jammies",
699: 'panpipe, pandean pipe, syrinx', "698": "palace",
700: 'paper towel', "699": "panpipe, pandean pipe, syrinx",
701: 'parachute, chute', "700": "paper towel",
702: 'parallel bars, bars', "701": "parachute, chute",
703: 'park bench', "702": "parallel bars, bars",
704: 'parking meter', "703": "park bench",
705: 'passenger car, coach, carriage', "704": "parking meter",
706: 'patio, terrace', "705": "passenger car, coach, carriage",
707: 'pay-phone, pay-station', "706": "patio, terrace",
708: 'pedestal, plinth, footstall', "707": "pay-phone, pay-station",
709: 'pencil box, pencil case', "708": "pedestal, plinth, footstall",
710: 'pencil sharpener', "709": "pencil box, pencil case",
711: 'perfume, essence', "710": "pencil sharpener",
712: 'Petri dish', "711": "perfume, essence",
713: 'photocopier', "712": "Petri dish",
714: 'pick, plectrum, plectron', "713": "photocopier",
715: 'pickelhaube', "714": "pick, plectrum, plectron",
716: 'picket fence, paling', "715": "pickelhaube",
717: 'pickup, pickup truck', "716": "picket fence, paling",
718: 'pier', "717": "pickup, pickup truck",
719: 'piggy bank, penny bank', "718": "pier",
720: 'pill bottle', "719": "piggy bank, penny bank",
721: 'pillow', "720": "pill bottle",
722: 'ping-pong ball', "721": "pillow",
723: 'pinwheel', "722": "ping-pong ball",
724: 'pirate, pirate ship', "723": "pinwheel",
725: 'pitcher, ewer', "724": "pirate, pirate ship",
726: "plane, carpenter's plane, woodworking plane", "725": "pitcher, ewer",
727: 'planetarium', "726": "plane, carpenter's plane, woodworking plane",
728: 'plastic bag', "727": "planetarium",
729: 'plate rack', "728": "plastic bag",
730: 'plow, plough', "729": "plate rack",
731: "plunger, plumber's helper", "730": "plow, plough",
732: 'Polaroid camera, Polaroid Land camera', "731": "plunger, plumber's helper",
733: 'pole', "732": "Polaroid camera, Polaroid Land camera",
734: 'police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria', "733": "pole",
735: 'poncho', "734": "police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria",
736: 'pool table, billiard table, snooker table', "735": "poncho",
737: 'pop bottle, soda bottle', "736": "pool table, billiard table, snooker table",
738: 'pot, flowerpot', "737": "pop bottle, soda bottle",
739: "potter's wheel", "738": "pot, flowerpot",
740: 'power drill', "739": "potter's wheel",
741: 'prayer rug, prayer mat', "740": "power drill",
742: 'printer', "741": "prayer rug, prayer mat",
743: 'prison, prison house', "742": "printer",
744: 'projectile, missile', "743": "prison, prison house",
745: 'projector', "744": "projectile, missile",
746: 'puck, hockey puck', "745": "projector",
747: 'punching bag, punch bag, punching ball, punchball', "746": "puck, hockey puck",
748: 'purse', "747": "punching bag, punch bag, punching ball, punchball",
749: 'quill, quill pen', "748": "purse",
750: 'quilt, comforter, comfort, puff', "749": "quill, quill pen",
751: 'racer, race car, racing car', "750": "quilt, comforter, comfort, puff",
752: 'racket, racquet', "751": "racer, race car, racing car",
753: 'radiator', "752": "racket, racquet",
754: 'radio, wireless', "753": "radiator",
755: 'radio telescope, radio reflector', "754": "radio, wireless",
756: 'rain barrel', "755": "radio telescope, radio reflector",
757: 'recreational vehicle, RV, R.V.', "756": "rain barrel",
758: 'reel', "757": "recreational vehicle, RV, R.V.",
759: 'reflex camera', "758": "reel",
760: 'refrigerator, icebox', "759": "reflex camera",
761: 'remote control, remote', "760": "refrigerator, icebox",
762: 'restaurant, eating house, eating place, eatery', "761": "remote control, remote",
763: 'revolver, six-gun, six-shooter', "762": "restaurant, eating house, eating place, eatery",
764: 'rifle', "763": "revolver, six-gun, six-shooter",
765: 'rocking chair, rocker', "764": "rifle",
766: 'rotisserie', "765": "rocking chair, rocker",
767: 'rubber eraser, rubber, pencil eraser', "766": "rotisserie",
768: 'rugby ball', "767": "rubber eraser, rubber, pencil eraser",
769: 'rule, ruler', "768": "rugby ball",
770: 'running shoe', "769": "rule, ruler",
771: 'safe', "770": "running shoe",
772: 'safety pin', "771": "safe",
773: 'saltshaker, salt shaker', "772": "safety pin",
774: 'sandal', "773": "saltshaker, salt shaker",
775: 'sarong', "774": "sandal",
776: 'sax, saxophone', "775": "sarong",
777: 'scabbard', "776": "sax, saxophone",
778: 'scale, weighing machine', "777": "scabbard",
779: 'school bus', "778": "scale, weighing machine",
780: 'schooner', "779": "school bus",
781: 'scoreboard', "780": "schooner",
782: 'screen, CRT screen', "781": "scoreboard",
783: 'screw', "782": "screen, CRT screen",
784: 'screwdriver', "783": "screw",
785: 'seat belt, seatbelt', "784": "screwdriver",
786: 'sewing machine', "785": "seat belt, seatbelt",
787: 'shield, buckler', "786": "sewing machine",
788: 'shoe shop, shoe-shop, shoe store', "787": "shield, buckler",
789: 'shoji', "788": "shoe shop, shoe-shop, shoe store",
790: 'shopping basket', "789": "shoji",
791: 'shopping cart', "790": "shopping basket",
792: 'shovel', "791": "shopping cart",
793: 'shower cap', "792": "shovel",
794: 'shower curtain', "793": "shower cap",
795: 'ski', "794": "shower curtain",
796: 'ski mask', "795": "ski",
797: 'sleeping bag', "796": "ski mask",
798: 'slide rule, slipstick', "797": "sleeping bag",
799: 'sliding door', "798": "slide rule, slipstick",
800: 'slot, one-armed bandit', "799": "sliding door",
801: 'snorkel', "800": "slot, one-armed bandit",
802: 'snowmobile', "801": "snorkel",
803: 'snowplow, snowplough', "802": "snowmobile",
804: 'soap dispenser', "803": "snowplow, snowplough",
805: 'soccer ball', "804": "soap dispenser",
806: 'sock', "805": "soccer ball",
807: 'solar dish, solar collector, solar furnace', "806": "sock",
808: 'sombrero', "807": "solar dish, solar collector, solar furnace",
809: 'soup bowl', "808": "sombrero",
810: 'space bar', "809": "soup bowl",
811: 'space heater', "810": "space bar",
812: 'space shuttle', "811": "space heater",
813: 'spatula', "812": "space shuttle",
814: 'speedboat', "813": "spatula",
815: "spider web, spider's web", "814": "speedboat",
816: 'spindle', "815": "spider web, spider's web",
817: 'sports car, sport car', "816": "spindle",
818: 'spotlight, spot', "817": "sports car, sport car",
819: 'stage', "818": "spotlight, spot",
820: 'steam locomotive', "819": "stage",
821: 'steel arch bridge', "820": "steam locomotive",
822: 'steel drum', "821": "steel arch bridge",
823: 'stethoscope', "822": "steel drum",
824: 'stole', "823": "stethoscope",
825: 'stone wall', "824": "stole",
826: 'stopwatch, stop watch', "825": "stone wall",
827: 'stove', "826": "stopwatch, stop watch",
828: 'strainer', "827": "stove",
829: 'streetcar, tram, tramcar, trolley, trolley car', "828": "strainer",
830: 'stretcher', "829": "streetcar, tram, tramcar, trolley, trolley car",
831: 'studio couch, day bed', "830": "stretcher",
832: 'stupa, tope', "831": "studio couch, day bed",
833: 'submarine, pigboat, sub, U-boat', "832": "stupa, tope",
834: 'suit, suit of clothes', "833": "submarine, pigboat, sub, U-boat",
835: 'sundial', "834": "suit, suit of clothes",
836: 'sunglass', "835": "sundial",
837: 'sunglasses, dark glasses, shades', "836": "sunglass",
838: 'sunscreen, sunblock, sun blocker', "837": "sunglasses, dark glasses, shades",
839: 'suspension bridge', "838": "sunscreen, sunblock, sun blocker",
840: 'swab, swob, mop', "839": "suspension bridge",
841: 'sweatshirt', "840": "swab, swob, mop",
842: 'swimming trunks, bathing trunks', "841": "sweatshirt",
843: 'swing', "842": "swimming trunks, bathing trunks",
844: 'switch, electric switch, electrical switch', "843": "swing",
845: 'syringe', "844": "switch, electric switch, electrical switch",
846: 'table lamp', "845": "syringe",
847: 'tank, army tank, armored combat vehicle, armoured combat vehicle', "846": "table lamp",
848: 'tape player', "847": "tank, army tank, armored combat vehicle, armoured combat vehicle",
849: 'teapot', "848": "tape player",
850: 'teddy, teddy bear', "849": "teapot",
851: 'television, television system', "850": "teddy, teddy bear",
852: 'tennis ball', "851": "television, television system",
853: 'thatch, thatched roof', "852": "tennis ball",
854: 'theater curtain, theatre curtain', "853": "thatch, thatched roof",
855: 'thimble', "854": "theater curtain, theatre curtain",
856: 'thresher, thrasher, threshing machine', "855": "thimble",
857: 'throne', "856": "thresher, thrasher, threshing machine",
858: 'tile roof', "857": "throne",
859: 'toaster', "858": "tile roof",
860: 'tobacco shop, tobacconist shop, tobacconist', "859": "toaster",
861: 'toilet seat', "860": "tobacco shop, tobacconist shop, tobacconist",
862: 'torch', "861": "toilet seat",
863: 'totem pole', "862": "torch",
864: 'tow truck, tow car, wrecker', "863": "totem pole",
865: 'toyshop', "864": "tow truck, tow car, wrecker",
866: 'tractor', "865": "toyshop",
867: 'trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi', "866": "tractor",
868: 'tray', "867": "trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi",
869: 'trench coat', "868": "tray",
870: 'tricycle, trike, velocipede', "869": "trench coat",
871: 'trimaran', "870": "tricycle, trike, velocipede",
872: 'tripod', "871": "trimaran",
873: 'triumphal arch', "872": "tripod",
874: 'trolleybus, trolley coach, trackless trolley', "873": "triumphal arch",
875: 'trombone', "874": "trolleybus, trolley coach, trackless trolley",
876: 'tub, vat', "875": "trombone",
877: 'turnstile', "876": "tub, vat",
878: 'typewriter keyboard', "877": "turnstile",
879: 'umbrella', "878": "typewriter keyboard",
880: 'unicycle, monocycle', "879": "umbrella",
881: 'upright, upright piano', "880": "unicycle, monocycle",
882: 'vacuum, vacuum cleaner', "881": "upright, upright piano",
883: 'vase', "882": "vacuum, vacuum cleaner",
884: 'vault', "883": "vase",
885: 'velvet', "884": "vault",
886: 'vending machine', "885": "velvet",
887: 'vestment', "886": "vending machine",
888: 'viaduct', "887": "vestment",
889: 'violin, fiddle', "888": "viaduct",
890: 'volleyball', "889": "violin, fiddle",
891: 'waffle iron', "890": "volleyball",
892: 'wall clock', "891": "waffle iron",
893: 'wallet, billfold, notecase, pocketbook', "892": "wall clock",
894: 'wardrobe, closet, press', "893": "wallet, billfold, notecase, pocketbook",
895: 'warplane, military plane', "894": "wardrobe, closet, press",
896: 'washbasin, handbasin, washbowl, lavabo, wash-hand basin', "895": "warplane, military plane",
897: 'washer, automatic washer, washing machine', "896": "washbasin, handbasin, washbowl, lavabo, wash-hand basin",
898: 'water bottle', "897": "washer, automatic washer, washing machine",
899: 'water jug', "898": "water bottle",
900: 'water tower', "899": "water jug",
901: 'whiskey jug', "900": "water tower",
902: 'whistle', "901": "whiskey jug",
903: 'wig', "902": "whistle",
904: 'window screen', "903": "wig",
905: 'window shade', "904": "window screen",
906: 'Windsor tie', "905": "window shade",
907: 'wine bottle', "906": "Windsor tie",
908: 'wing', "907": "wine bottle",
909: 'wok', "908": "wing",
910: 'wooden spoon', "909": "wok",
911: 'wool, woolen, woollen', "910": "wooden spoon",
912: 'worm fence, snake fence, snake-rail fence, Virginia fence', "911": "wool, woolen, woollen",
913: 'wreck', "912": "worm fence, snake fence, snake-rail fence, Virginia fence",
914: 'yawl', "913": "wreck",
915: 'yurt', "914": "yawl",
916: 'web site, website, internet site, site', "915": "yurt",
917: 'comic book', "916": "web site, website, internet site, site",
918: 'crossword puzzle, crossword', "917": "comic book",
919: 'street sign', "918": "crossword puzzle, crossword",
920: 'traffic light, traffic signal, stoplight', "919": "street sign",
921: 'book jacket, dust cover, dust jacket, dust wrapper', "920": "traffic light, traffic signal, stoplight",
922: 'menu', "921": "book jacket, dust cover, dust jacket, dust wrapper",
923: 'plate', "922": "menu",
924: 'guacamole', "923": "plate",
925: 'consomme', "924": "guacamole",
926: 'hot pot, hotpot', "925": "consomme",
927: 'trifle', "926": "hot pot, hotpot",
928: 'ice cream, icecream', "927": "trifle",
929: 'ice lolly, lolly, lollipop, popsicle', "928": "ice cream, icecream",
930: 'French loaf', "929": "ice lolly, lolly, lollipop, popsicle",
931: 'bagel, beigel', "930": "French loaf",
932: 'pretzel', "931": "bagel, beigel",
933: 'cheeseburger', "932": "pretzel",
934: 'hotdog, hot dog, red hot', "933": "cheeseburger",
935: 'mashed potato', "934": "hotdog, hot dog, red hot",
936: 'head cabbage', "935": "mashed potato",
937: 'broccoli', "936": "head cabbage",
938: 'cauliflower', "937": "broccoli",
939: 'zucchini, courgette', "938": "cauliflower",
940: 'spaghetti squash', "939": "zucchini, courgette",
941: 'acorn squash', "940": "spaghetti squash",
942: 'butternut squash', "941": "acorn squash",
943: 'cucumber, cuke', "942": "butternut squash",
944: 'artichoke, globe artichoke', "943": "cucumber, cuke",
945: 'bell pepper', "944": "artichoke, globe artichoke",
946: 'cardoon', "945": "bell pepper",
947: 'mushroom', "946": "cardoon",
948: 'Granny Smith', "947": "mushroom",
949: 'strawberry', "948": "Granny Smith",
950: 'orange', "949": "strawberry",
951: 'lemon', "950": "orange",
952: 'fig', "951": "lemon",
953: 'pineapple, ananas', "952": "fig",
954: 'banana', "953": "pineapple, ananas",
955: 'jackfruit, jak, jack', "954": "banana",
956: 'custard apple', "955": "jackfruit, jak, jack",
957: 'pomegranate', "956": "custard apple",
958: 'hay', "957": "pomegranate",
959: 'carbonara', "958": "hay",
960: 'chocolate sauce, chocolate syrup', "959": "carbonara",
961: 'dough', "960": "chocolate sauce, chocolate syrup",
962: 'meat loaf, meatloaf', "961": "dough",
963: 'pizza, pizza pie', "962": "meat loaf, meatloaf",
964: 'potpie', "963": "pizza, pizza pie",
965: 'burrito', "964": "potpie",
966: 'red wine', "965": "burrito",
967: 'espresso', "966": "red wine",
968: 'cup', "967": "espresso",
969: 'eggnog', "968": "cup",
970: 'alp', "969": "eggnog",
971: 'bubble', "970": "alp",
972: 'cliff, drop, drop-off', "971": "bubble",
973: 'coral reef', "972": "cliff, drop, drop-off",
974: 'geyser', "973": "coral reef",
975: 'lakeside, lakeshore', "974": "geyser",
976: 'promontory, headland, head, foreland', "975": "lakeside, lakeshore",
977: 'sandbar, sand bar', "976": "promontory, headland, head, foreland",
978: 'seashore, coast, seacoast, sea-coast', "977": "sandbar, sand bar",
979: 'valley, vale', "978": "seashore, coast, seacoast, sea-coast",
980: 'volcano', "979": "valley, vale",
981: 'ballplayer, baseball player', "980": "volcano",
982: 'groom, bridegroom', "981": "ballplayer, baseball player",
983: 'scuba diver', "982": "groom, bridegroom",
984: 'rapeseed', "983": "scuba diver",
985: 'daisy', "984": "rapeseed",
986: "yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum", "985": "daisy",
987: 'corn', "986": "yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum",
988: 'acorn', "987": "corn",
989: 'hip, rose hip, rosehip', "988": "acorn",
990: 'buckeye, horse chestnut, conker', "989": "hip, rose hip, rosehip",
991: 'coral fungus', "990": "buckeye, horse chestnut, conker",
992: 'agaric', "991": "coral fungus",
993: 'gyromitra', "992": "agaric",
994: 'stinkhorn, carrion fungus', "993": "gyromitra",
995: 'earthstar', "994": "stinkhorn, carrion fungus",
996: 'hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa', "995": "earthstar",
997: 'bolete', "996": "hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa",
998: 'ear, spike, capitulum', "997": "bolete",
999: 'toilet tissue, toilet paper, bathroom tissue'} "998": "ear, spike, capitulum",
"999": "toilet tissue, toilet paper, bathroom tissue"
}
\ No newline at end of file
...@@ -126,7 +126,6 @@ ...@@ -126,7 +126,6 @@
2, 2,
2 2
] ]
}, }
] ]
} }
...@@ -22,7 +22,7 @@ const unitPath = { ...@@ -22,7 +22,7 @@ const unitPath = {
'split': 'model.test.split.json' 'split': 'model.test.split.json'
}; };
// 制定运行的 op // 制定运行的 op
const modelType = 'split'; const modelType = 'conv2d';
// 制定运行的 op // 制定运行的 op
const unitData = unitPath[modelType]; const unitData = unitPath[modelType];
...@@ -63,13 +63,13 @@ async function run() { ...@@ -63,13 +63,13 @@ async function run() {
// 获取 NHWC -> NCHW 的 输出 // 获取 NHWC -> NCHW 的 输出
const outputNCHWShape = getOutputShape(); const outputNCHWShape = getOutputShape();
const outputNHWCShape = nchwShape2nhwcShape(outputNCHWShape); const outputNHWCShape = nchwShape2nhwcShape(outputNCHWShape);
let nchwResult = Utils.nhwc2nchw(result, outputNHWCShape);
console.log('result'); let nchwResult = Utils.nhwc2nchw(result, outputNHWCShape);
console.log(result); const formatData = Utils.formatReadData(nchwResult, outputNCHWShape);
console.log('NCHW RESULT'); console.log('NCHW RESULT');
console.log(nchwResult); console.log(formatData);
} }
run(); run();
...@@ -112,6 +112,7 @@ function nchwShape2nhwcShape(nchw) { ...@@ -112,6 +112,7 @@ function nchwShape2nhwcShape(nchw) {
} }
batchNCHW = batch.concat(nchw); batchNCHW = batch.concat(nchw);
} }
const N = batchNCHW[0]; const N = batchNCHW[0];
const C = batchNCHW[1]; const C = batchNCHW[1];
const H = batchNCHW[2]; const H = batchNCHW[2];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册