def test_vgg_cnn_s(self): self._test_model( model_path=download_once( url= "http://www.robots.ox.ac.uk/~vgg/software/deep_eval/releases/bvlc/VGG_CNN_S.caffemodel", path="_models/caffe/vgg_cnn_s/"), prototxt_path=download_once( url= "https://gist.githubusercontent.com/ksimonyan/fd8800eeb36e276cd6f9/raw/e8dbbd31fc037fdf5430d89c102619e31ca7e8ef/VGG_CNN_S_deploy.prototxt", path="_models/caffe/vgg_cnn_s/"))
def test_squeezenet_v1_0(self): self._test_network( model_path=download_once( url= "https://github.com/DeepScale/SqueezeNet/blob/master/SqueezeNet_v1.0/squeezenet_v1.0.caffemodel?raw=true", path="_models/caffe/squeezenet_v1_0/"), prototxt_path=download_once( url= "https://raw.githubusercontent.com/DeepScale/SqueezeNet/master/SqueezeNet_v1.0/deploy.prototxt", path="_models/caffe/squeezenet_v1_0/"))
def test_finetune_flickr_style(self): self._test_model( model_path=download_once( url= "http://dl.caffe.berkeleyvision.org/finetune_flickr_style.caffemodel", path="_models/caffe/finetune_flickr_style/"), prototxt_path=download_once( url= "https://raw.githubusercontent.com/BVLC/caffe/1.0/models/finetune_flickr_style/deploy.prototxt", path="_models/caffe/finetune_flickr_style/"))
def test_bvlc_reference_rcnn_ilsvrc13(self): self._test_model( model_path=download_once( url= "http://dl.caffe.berkeleyvision.org/bvlc_reference_rcnn_ilsvrc13.caffemodel", path="_models/caffe/bvlc_reference_rcnn_ilsvrc13/"), prototxt_path=download_once( url= "https://raw.githubusercontent.com/BVLC/caffe/1.0/models/bvlc_reference_rcnn_ilsvrc13/deploy.prototxt", path="_models/caffe/bvlc_reference_rcnn_ilsvrc13/"))
def test_googlenet_cars(self): self._test_model( model_path=download_once( url= "http://mmlab.ie.cuhk.edu.hk/datasets/comp_cars/googlenet_finetune_web_car_iter_10000.caffemodel", path="_models/caffe/googlenet_cars/"), prototxt_path=download_once( url= "https://gist.githubusercontent.com/bogger/b90eb88e31cd745525ae/raw/b5dd8c1a58318fdceeeac00322c90e4a865c3229/deploy.prototxt", path="_models/caffe/googlenet_cars/"))
def test_resnet_50(self): self._test_model( model_path=download_once( url= "https://iuxblw.bn.files.1drv.com/y4mF6T7yV0cre7yjwvz4rwfcUk8adzqXG4OmKYGhHuzBXL7MGquwpfvxP883jlrV2xnt2H1w9gv3UFSqVtdWc-JrzglovVYLwh8dlorrKMoADRPiMe0aDyLXGxD6_ru9rA_2vcsnIgy7EV-JIKAI9Pd5nkOKUROu8hJWq6B1-TUJMxIlbrBcso7QNmARdgam8-E_VUqRYY5G0CtaptNdeorQA/ResNet-50-model.caffemodel", path="_models/caffe/resnet_50/"), prototxt_path=download_once( url= "https://iuxblw.bn.files.1drv.com/y4mxb8uknveQa_FiQdSOcLSwSboxCuDM2U2lwq2UudIQzXJMUVx1SCabgoQxLBDpDhpxIZBagj4yVVdHvs235X5XQdRqJt1LVYwyS58By14iQGaauVhjLSJOA2_x1dy44Xe2BLkwlcxbL2CdPOAWo-uMTJhFOoVnfXXbyfh7Sgb5U4wr7fY0ewmXKbJTqF6B6fh3OErOXD0jhHXxndAfjPjtw/ResNet-50-deploy.prototxt", path="_models/caffe/resnet_50/"))
def test_nin_imagenet(self): self._test_model( model_path=download_once( url= "https://www.dropbox.com/s/0cidxafrb2wuwxw/nin_imagenet.caffemodel?dl=1", path="_models/caffe/nin_imagenet/"), prototxt_path=download_once( url= "https://gist.githubusercontent.com/tzutalin/0e3fd793a5b13dd7f647/raw/207d710d2e089423eda4b0b76ca4b139b7a461f7/deploy.prototxt", path="_models/caffe/nin_imagenet/"))
def test_mobilenet_v1(self): self._test_network( model_path=download_once( url= "https://github.com/shicai/MobileNet-Caffe/blob/master/mobilenet.caffemodel?raw=true", path="_models/caffe/mobilenet_v1/"), prototxt_path=download_once( url= "https://raw.githubusercontent.com/shicai/MobileNet-Caffe/master/mobilenet_deploy.prototxt", path="_models/caffe/mobilenet_v1/"))
def test_bvlc_googlenet(self): self._test_model( model_path=download_once( url= "http://dl.caffe.berkeleyvision.org/bvlc_googlenet.caffemodel", path="_models/caffe/bvlc_googlenet/"), prototxt_path=download_once( url= "https://raw.githubusercontent.com/BVLC/caffe/1.0/models/bvlc_googlenet/deploy.prototxt", path="_models/caffe/bvlc_googlenet/"))
def test_vgg_16(self): self._test_model( model_path=download_once( url= "http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel", path="_models/caffe/vgg_16/"), prototxt_path=download_once( url= "https://gist.githubusercontent.com/ksimonyan/211839e770f7b538e2d8/raw/ded9363bd93ec0c770134f4e387d8aaaaa2407ce/VGG_ILSVRC_16_layers_deploy.prototxt", path="_models/caffe/vgg_16/"))
def download_caffe2_model(name): predict_net_url = "https://s3.amazonaws.com/download.caffe2.ai/models/{}/predict_net.pb".format( name) init_net_url = "https://s3.amazonaws.com/download.caffe2.ai/models/{}/init_net.pb".format( name) value_info_url = "https://raw.githubusercontent.com/caffe2/models/master/{}/value_info.json".format( name) out_dir = "_models/caffe2/{}/".format(name) return (download_once(predict_net_url, out_dir), download_once(init_net_url, out_dir), download_once(value_info_url, out_dir))
def test_mobilenet_v2(self): self._test_model( download_once( 'https://s3.amazonaws.com/download.caffe2.ai/models/mobilenet_v2/predict_net.pb', '_models/caffe2/mobilenet_v2/'), download_once( 'https://s3.amazonaws.com/download.caffe2.ai/models/mobilenet_v2/init_net.pb', '_models/caffe2/mobilenet_v2/'), download_once( # not at the usual place 'https://media.githubusercontent.com/media/caffe2/models/master/mobilenet_v2/value_info.json', '_models/caffe2/mobilenet_v2/'))
def test_googlenet_inception_v2(self): download_once( "https://sfo2.digitaloceanspaces.com/nnef-public/inception_v2.onnx.nnef.tgz", path="_models/nnef/") self.assertEqual( 0, os.system( './nnef_tools/generate_inputs.py _models/nnef/inception_v2.onnx.nnef.tgz' ' --params "Random(uniform, 0, 255)"' '|' './nnef_tools/infer.py _models/nnef/inception_v2.onnx.nnef.tgz' ' --output-names ../../../out/googlenet_inception_v2/'))
def test_vgg16(self): download_once( "https://sfo2.digitaloceanspaces.com/nnef-public/vgg16.onnx.nnef.tgz", path="_models/nnef/") self.assertEqual( 0, os.system( './nnef_tools/generate_inputs.py _models/nnef/vgg16.onnx.nnef.tgz' ' --params "Random(uniform, 0, 1)" --shape 2 3 224 224' '|' './nnef_tools/infer.py _models/nnef/vgg16.onnx.nnef.tgz' ' --output-names ../../../out/vgg16/'))
def test_arcface(self): # original ONNX is not runnable self._test_model(download_once( url= "https://s3.amazonaws.com/onnx-model-zoo/arcface/resnet100/resnet100.onnx", path="_models/onnx/arcface_resnet100.onnx"), compare=False)
def test_resnet18v1(self): # ONNX has some problem with running the BatchNorm version 7 self._test_model(download_once( url= "https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet18v1/resnet18v1.onnx", path="_models/onnx/"), compare=False)
def test_mobilenetv2_1_0(self): self._test_model( download_once( url= "https://s3.amazonaws.com/onnx-model-zoo/mobilenet/mobilenetv2-1.0/mobilenetv2-1.0.onnx", path="_models/onnx/"))
def test_resnet101v2(self): self._test_model( download_once( url= "https://s3.amazonaws.com/onnx-model-zoo/resnet/resnet101v2/resnet101v2.onnx", path="_models/onnx/"))
def test_vgg16(self): self._test_model( download_once( url= "https://s3.amazonaws.com/onnx-model-zoo/vgg/vgg16/vgg16.onnx", path="_models/onnx/"))
def test_squeezenet1_1(self): self._test_model( download_once( url= "https://s3.amazonaws.com/onnx-model-zoo/squeezenet/squeezenet1.1/squeezenet1.1.onnx", path="./_models/onnx/"))
def test_legacy_io_caffenet(self): self._test_io( download_once( url= "https://raw.githubusercontent.com/intelcaffe/caffe-old/master/examples/imagenet/imagenet_deploy.prototxt", path="_models/caffe/old_caffenet/"))