Closed chenyi10 closed 7 months ago
Can you please share the code you are using?
Thanks! Diego
net = importNetworkFromTensorFlow('C:\Users\Administrator\Desktop\safe_uav\uav\tf2_model\my_model'); dataArray1 = rand(8,10); dataArray2 = rand(8,10) dlX1 = dlarray(dataArray1,"TSC"); %disp(dlX1) %net = initialize(net, dlX1); summary(net) F = matlab2nnv(net);
%% test 1: falsify
% create NN W = [1 1; 0 1]; b = [0; 0.5]; L = LayerS(W, b, 'poslin'); Layers = {L};
%F = NN(Layers);
% create input set IM = rand(8,10) LB = rand(8,10) UB = rand(8,10) K = ImageStar(IM, LB, UB)
% compute reachability
%reachMethod = 'approx-star'; % 使用近似星形集方法
%F.reachMethod = reachMethod; % 设置网络的可达集计算方法
R = F.reach(K);
outputs = F.evaluate(K);
% Create unsafe region
% 定义半空间矩阵和向量
G = rand(8,64);
g = randn(8, 1);
U = HalfSpace(G, g);
% define number of samples to attempt falsification n_samples = 10; % find counter examples counter_inputs = F.falsify(K, U, n_samples); counter_outputs = F.evaluate(counter_inputs);
Here is my code,Thanks!do you have some idea @mldiego
Could you share the tensorflow model with me?? Which MATLAB version are you using?
of course , The version of MATLAB is the latest one. my_model.zip
I have added an example, based on your code, to evaluate (inference) and run reachability using your model here: https://github.com/verivital/nnv/tree/master/code/nnv/examples/other/issues/chenyi10
I will close the issue now, please let me know if there is anything else we can help with.
Example and fix can be found on #217
Thanks for your help,i have one last question,do this model is supported to generate counter inputs and outputs
Not directly. But you could run random inferences (evaluateSequence
), and then check if they meet the specification separately one time-step at a time.
未识别类 'Conv1DLayer' 的方法、属性或字段 'evaluate'。
出错 NN/evaluate_withConns (第 1123 行) y = obj.Layers{source_indx}.evaluate(x);
出错 NN/evaluate (第 130 行) y = obj.evaluate_withConns(x);
出错 NN/falsify (第 697 行) y = obj.evaluate(V(:, i));
出错 safe_uav (第 49 行) counter_inputs = F.falsify(I, U, n_samples);
whether Conv1DLayer can not do the test : falsify, isRobust, safety