LEEay

Results 13 comments of LEEay

使用的是KichangKim/DeepDanbooru github上的项目,tags v3-20211112-sgd-e28, 然后根据djl文档的转化成pb模型 我的tfjava代码: Session session = SavedModelBundle.load("E:\\Download\\mymodel\\deepdanbooru-v3-20211112", "serve").session(); float[][] input = { {2.6327686f, -9.201903f}, {-1.3209248f, 8.569574f}, {-5.6642127f, 3.3681698f}, {9.604832f, 5.9664965f}, {-0.8812313f, -6.76733f} }; LongNdArray matrix3d = NdArrays.ofLongs(Shape.of(1, 100,...

有人能帮忙看看吗?或者有社区地址什么的吗?微信群或者qq群?

模型地址https://github.com/KichangKim/DeepDanbooru/tags, 使用的v3-20211112-sgd-e28 这个tag,然后使用djl官方的代码转成的.pb 代码: loaded_model = tf.keras.models.load_model(r"E:\Download\model-resnet_custom_v3.h5", compile=False) tf.saved_model.save(loaded_model, r"E:\Download\1")

https://github.com/deepjavalibrary/djl/issues/3173#issuecomment-2150572369 使用python的代码可以执行转换后的模型文件 import tensorflow as tf import tensorflow_io as tfio import skimage # model = tf.keras.models.load_model(r"E:\Download\model-resnet_custom_v3.h5", compile=False) model = tf.saved_model.load(r"E:\Download\deepdanbooru-v3-20211112") def evaluate_image( image_input: str ,model:object, threshold: float ) : #...

https://github.com/deepjavalibrary/djl/issues/3173#issuecomment-2150593236 因为模型的示例里的转化图片的方法,在djl里我不会转化,所以我现在使用djl 调用python的前置操作来转化图片,然后用djl调用模型文件来推理。 这个是我的model.py,转化图片代码 `import tensorflow as tf import tensorflow_io as tfio import skimage import logging from typing import Optional, Any from djl_python import Input from djl_python import Output from...

这个是加载模型的代码 Device device = Device.Type.CPU.equalsIgnoreCase(prop.getDeviceType()) ? Device.cpu() : Device.gpu(); PythonTranslator translator = new PythonTranslator(); Criteria criteria = Criteria.builder() .optEngine(ENGINE_TENSORFLOW) .optDevice(device) .optModelUrls(getRealUrl(prop.getDetectUrl())) .setTypes(String.class, Classifications.class) .optProgress(new ProgressBar()) .optTranslator(translator) .build(); detectionModel = criteria.loadModel();

tfjava调用也是错误的,我再问问吧,感觉java的多不稳定,没有python的兼容性好,估计是模型是用python写的吧

根据工具解决了dll缺失问题,但是运行还是报错,ptions.TFFailedPreconditionException: Could not find variable batch_normalization_170/moving_mean. This could mean that the variable has been deleted. In TF1, it can also mean the variable is uninitialized. Debug info: container=localhost, status error...

我是转成了.pb模型, `import tensorflow as tf import tf2onnx loaded_model = tf.keras.models.load_model(r"E:\Download\model-resnet_custom_v3.h5", compile=False) # 保存模型为.pb tf.saved_model.save(loaded_model, r"E:\Download\mymodel\deepdanbooru-v3-20211112") # 加载已保存的模型 loaded_model = tf.saved_model.load(r"E:\Download\mymodel\deepdanbooru-v3-20211112\saved_model.pb")` 使用的是https://github.com/KichangKim/DeepDanbooru/tags 里面的 [v3-20211112-sgd-e28](https://github.com/KichangKim/DeepDanbooru/releases/tag/v3-20211112-sgd-e28) 转化后在tfjava里运行报错 `Session session = SavedModelBundle.load("E:\\Download\\mymodel\\deepdanbooru-v3-20211112", "serve").session(); FloatNdArray...