{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from crnn_pytorch_Gas.models import crnn as net\n",
    "from crnn_pytorch_Gas import params\n",
    "\n",
    "def weights_init(self,m):\n",
    "    classname = m.__class__.__name__\n",
    "    if classname.find('Conv') != -1:\n",
    "        m.weight.data.normal_(0.0, 0.02 )\n",
    "    elif classname.find('BatchNorm') != -1:\n",
    "        m.weight.data.normal_(1.0, 0.02)\n",
    "        m.bias.data.fill_(0)\n",
    "        \n",
    "def net_init():\n",
    "    nclass = len(params.alphabet) + 1\n",
    "    crnn = net.CRNN(params.imgH, params.nc, nclass, params.nh)\n",
    "    crnn.apply(self.weights_init)\n",
    "    if params.pretrained != '':\n",
    "        print(params.expr_dir)\n",
    "        print('loading pretrained model from %s' % params.pretrained)\n",
    "        if params.multi_gpu:\n",
    "            self.crnn = torch.nn.DataParallel(self.crnn)\n",
    "        self.crnn.load_state_dict(torch.load(params.pretrained))\n",
    "    return self.crnn\n",
    "\n",
    "crnn=net_init()\n",
    "print(crnn)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Accuracy_Test",
   "language": "python",
   "name": "accuracy_test"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
