How to use the @tensorflow/tfjs-node-gpu.data function in @tensorflow/tfjs-node-gpu

To help you get started, we’ve selected a few @tensorflow/tfjs-node-gpu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alibaba / pipcook / packages / pipcook-plugins-image-detection-data-access / src / index.ts View on Github external
const dataSample = data[i];
    const {trainDataPath, validationDataPath, testDataPath} = dataSample;  
    const trainFileNames: string[] = await glob(path.join(trainDataPath, '*.xml'));
    await concatenateDataFlows(trainFileNames, imgSize, oneHotMap, trainDataFlows, 'train data');
    if (validationDataPath) {
      const validationFileNames: string[] = await glob(path.join(validationDataPath, '*.xml'));
      await concatenateDataFlows(validationFileNames, imgSize, oneHotMap, validationDataFlows, 'validation data');
    }
    if (testDataPath) {
      const testFileNames: string[] = await glob(path.join(testDataPath, '*.xml'));
      await concatenateDataFlows(testFileNames, imgSize, oneHotMap, testDataFlows, 'test data');
    }
  }

  const result: UniformTfSampleData = {
    trainData: tf.data.array(trainDataFlows),
    metaData: {
      feature:
        {
          name: 'xs',
          type: 'float32',
          shape: [imgSize[0], imgSize[1], 3]
        },
      label: {
        name: 'ys',
        type: 'int32',
        shape: [1,Object.keys(oneHotMap).length],
        valueMap: oneHotMap
      },
    }
  };
  if (validationDataFlows.length > 0) {
github alibaba / pipcook / packages / pipcook-plugins-image-detection-data-access / src / index.ts View on Github external
feature:
        {
          name: 'xs',
          type: 'float32',
          shape: [imgSize[0], imgSize[1], 3]
        },
      label: {
        name: 'ys',
        type: 'int32',
        shape: [1,Object.keys(oneHotMap).length],
        valueMap: oneHotMap
      },
    }
  };
  if (validationDataFlows.length > 0) {
    result.validationData = tf.data.array(validationDataFlows);
  }
  if (testDataFlows.length > 0) {
    result.testData = tf.data.array(testDataFlows);
  }
  
  return result;
}
github alibaba / pipcook / packages / pipcook-plugins-image-class-data-access / src / index.ts View on Github external
type: 'float32',
          shape: [imgSize[0], imgSize[1], 3]
        },
      label: {
        name: 'ys',
        type: 'int32',
        shape: [1,Object.keys(oneHotMap).length],
        valueMap: oneHotMap
      },
    }
  };
  if (validationDataFlows.length > 0) {
    result.validationData = tf.data.array(validationDataFlows);
  }
  if (testDataFlows.length > 0) {
    result.testData = tf.data.array(testDataFlows);
  }
  
  return result;
}
github alibaba / pipcook / packages / pipcook-plugins-image-class-data-access / src / index.ts View on Github external
const {trainDataPath, validationDataPath, testDataPath} = dataSample;  
    const imagePath = path.join(trainDataPath, '..', '..', 'images')
    const trainFileNames: string[] = await glob(path.join(trainDataPath, '*.xml'));
    await concatenateDataFlows(trainFileNames, imgSize, oneHotMap, trainDataFlows, 'train data', imagePath);
    if (validationDataPath) {
      const validationFileNames: string[] = await glob(path.join(validationDataPath, '*.xml'));
      await concatenateDataFlows(validationFileNames, imgSize, oneHotMap, validationDataFlows, 'validation data', imagePath);
    }
    if (testDataPath) {
      const testFileNames: string[] = await glob(path.join(testDataPath, '*.xml'));
      await concatenateDataFlows(testFileNames, imgSize, oneHotMap, testDataFlows, 'test data', imagePath);
    }
  }

  const result: UniformTfSampleData = {
    trainData: tf.data.array(trainDataFlows),
    metaData: {
      feature:
        {
          name: 'xs',
          type: 'float32',
          shape: [imgSize[0], imgSize[1], 3]
        },
      label: {
        name: 'ys',
        type: 'int32',
        shape: [1,Object.keys(oneHotMap).length],
        valueMap: oneHotMap
      },
    }
  };
  if (validationDataFlows.length > 0) {