我想用react-native来tensorflow-js,所以我阅读了文档 在其中,在图像到张量时使用decodeJpeg进行写入。 但找不到解码Jpeg
如何使用encodeJpeg或寻找其他方法?
[
....
import * as tf from '@tensorflow/tfjs';
import {decodeJpeg, fetch} from '@tensorflow/tfjs-react-native';
var jpeg = require('jpeg-js');
const App= () => {
const [isTfready, setIsTfready] = useState(false);
async function test() {
await tf.ready();
setIsTfready(true);
const image = require('./answer.jpg');
const imageAssetPath = Image.resolveAssetSource(image);
const response = await fetch(imageAssetPath.uri, {}, { isBinary: true });
const rawImageData = await response.arrayBuffer();
const imageTensor = decodeJpeg(rawImageData);
.....
] 1
错误TypeError:(0,_tfjsReactNative.decodeJpeg)不是函数。 (在'((0,_tfjsReactNative.decodeJpeg)(rawImageData)'中,'((0,_tfjsReactNative.decodeJpeg)'未定义)