抜粋したコードで評価 Iterator⇒成功 In [56]: my_net = MLP () serializers . load_npz ( 'my_mnist.model' , my_net ) In [57]: train_iter = iterators . SerialIterator ( train_val , batchsize ) x , t = concat_examples ( train_iter . next (), gpu_id ) with chainer . using_config ( 'train' , False ), chainer . using_config ( 'enable_backprop' , False ): y = net ( x ) accuracy = F . accuracy ( y , t ) print ( accuracy . array ) 0.984375 抜粋したコードで評価 画像1枚⇒成功 In [59]: x , t = test [ random . randint ( 0 , len ( test ))] x = infer_net . xp . asarray ( x [ None , ... ]) with chainer . using_config ( 'train' , False ), chainer . using_config ( 'enable_backprop' , False ): y = infer_net ( x ) y = y . array print ( y ) print ( y . argmax ( axis = 1 )[ 0 ], t ) [[ -0.13074946 -3.27831101 14.03434944 4.3200264 -9.22432804 -6.01922178 ...
コメント
コメントを投稿