简体   繁体   中英

Rookie for Keras: how to load a pretrained MalConv model to predict in my data?

I want to use pretrained MalConv.h5 to predict in own dataset.

I installed the environment(Keras, tensorflow) following this VM

from numpy import loadtxt
from keras.models import load_model
import h5py

model = load_model('malconv.h5')
model.summary()

prediction = 
model.predict('data/train/0014D73E9987A3FC3DA1055D912286B95929DC6D')

Print(prediction)

Result:

2019-10-30 08:06:09.605829: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA

How can I get prediction(expected result) to data file: malware 1, benign 0?

What is the data that you are trying to predict? It looks like you are trying to access something on disk without reading it into memory.

You need to read the data into a variable and then pass it to the predict() method

I found this article which might be of use, the thing is that you are passing a string, not a file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM