σ šΔοYc@s¨dZdddgZddlmZddlmZddlmZd d lm Z d „Z d d „Z defd„ƒYZ e eƒd„Zd„Zd„ZdS(s!SqueezeNet, implemented in Gluon.t SqueezeNett squeezenet1_0t squeezenet1_1i(tcpui(t HybridBlock(tnni(tHybridConcurrentcCs}tjddƒ}|jt|dƒƒtddddƒ}|jt|dƒƒ|jt|ddƒƒ|j|ƒ|S(Ntprefixtit concat_dimi(RtHybridSequentialtaddt_make_fire_convR(tsqueeze_channelstexpand1x1_channelstexpand3x3_channelstouttpaths((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pyt _make_fires icCsKtjddƒ}|jtj||d|ƒƒ|jtjdƒƒ|S(NRRtpaddingtrelu(RR R tConv2Dt Activation(tchannelst kernel_sizeRR((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pyR (scBs#eZdZdd„Zd„ZRS(scSqueezeNet model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" `_ paper. SqueezeNet 1.1 model from the `official SqueezeNet repo `_. SqueezeNet 1.1 has 2.4x less computation and slightly fewer parameters than SqueezeNet 1.0, without sacrificing accuracy. Parameters ---------- version : str Version of squeezenet. Options are '1.0', '1.1'. classes : int, default 1000 Number of classification classes. iθc Ks6tt|ƒj||dks:tdjd|ƒƒ‚|jƒκtjddƒ|_|dkr|jj tj ddd d d ƒƒ|jj tj d ƒƒ|jj tj d dd d dt ƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tj d dd d dt ƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tj d dd d dt ƒƒ|jj tdddƒƒn–|jj tj dddd d ƒƒ|jj tj d ƒƒ|jj tj d dd d dt ƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tj d dd d dt ƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tj d dd d dt ƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tdddƒƒ|jj tdddƒƒtjddƒ|_|jj tjdƒƒ|jj tj |ddƒƒ|jj tj d ƒƒ|jj tjdƒƒ|jj tjƒƒWdQXdS(Ns1.0s1.1s<Unsupported SqueezeNet version {version}:1.0 or 1.1 expectedtversionRRi`RitstridesiRt pool_sizeit ceil_modeii@i i€i0iΐigΰ?ii (s1.0s1.1(tsuperRt__init__tAssertionErrortformatt name_scopeRR tfeaturesR RRt MaxPool2DtTrueRt classifiertDropoutt AvgPool2DtFlatten(tselfRtclassestkwargs((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pyR>sL   %(((%(((cCs"|j|ƒ}|j|ƒ}|S(N(R"R%(R)tFtx((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pythybrid_forwardhs(t__name__t __module__t__doc__RR.(((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pyR/s *cKsIt||}|rEddlm}|j|d|ƒd|ƒn|S(sΤSqueezeNet model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" `_ paper. SqueezeNet 1.1 model from the `official SqueezeNet repo `_. SqueezeNet 1.1 has 2.4x less computation and slightly fewer parameters than SqueezeNet 1.0, without sacrificing accuracy. Parameters ---------- version : str Version of squeezenet. Options are '1.0', '1.1'. pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which to load the pretrained weights. i(tget_model_files squeezenet%stctx(Rt model_storeR2t load_params(Rt pretrainedR3R+tnetR2((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pytget_squeezenetns  cKs td|S(s‚SqueezeNet 1.0 model from the `"SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size" `_ paper. Parameters ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which to load the pretrained weights. s1.0(R8(R+((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pyR…s cKs td|S(sεSqueezeNet 1.1 model from the `official SqueezeNet repo `_. SqueezeNet 1.1 has 2.4x less computation and slightly fewer parameters than SqueezeNet 1.0, without sacrificing accuracy. Parameters ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which to load the pretrained weights. s1.1(R8(R+((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pyR’s N(R1t__all__tcontextRtblockRRRt custom_layersRRR RtFalseR8RR(((sGbuild/bdist.linux-armv7l/egg/mxnet/gluon/model_zoo/vision/squeezenet.pyts ?