import neural_network |
import npufs |
with npufs.open('folderWithNet/example.blob', 'rb') as model_file: |
net = neural_network.init(model_file.read(), shaves_nn=4, use_cnns=(True, True)) |
#... |
#input data from frame |
print(type(frame.data())) #output: <class 'ExternalBuffer'> |
results = net.run(frame.data()) |
#return as array |
results = net.run(input_data) |
print(type(results)) #output: <class 'array'> |
#return as dictionary |
results = net.run(input_data, results_dict=True) |
print(type(results)) #output: <class 'dict'> |
#access output as dictionary |
keys = [for k in results.keys()] |
class_index, _ = max(list(enumerate(results[keys[0]])), key=lambda x: x[1]) |
print(class_index) #number of outputs from network |
#... |
#release network |
net.release() |
del net |