146 lines
3.3 KiB
Plaintext
Executable File
146 lines
3.3 KiB
Plaintext
Executable File
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "b255d360-ca4b-4bce-ae31-cd51f80565dc",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import glob\n",
|
|
"import time\n",
|
|
"import timm\n",
|
|
"import torch\n",
|
|
"import collections\n",
|
|
"import torch.nn as nn\n",
|
|
"import numpy as np\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"from torchinfo import summary as ts\n",
|
|
"\n",
|
|
"from thop import profile\n",
|
|
"from sklearn.manifold import TSNE\n",
|
|
"\n",
|
|
"from core.model import *\n",
|
|
"from core.data import *\n",
|
|
"from core.metrics import *\n",
|
|
"\n",
|
|
"from torch_geometric.loader import DataLoader\n",
|
|
"from torch_geometric.nn import summary as nns\n",
|
|
"\n",
|
|
"import torch.nn as nn"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "d6f9b93a-d572-459e-aee5-355dcc32105e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"model = C_FCRN_Aux(3).cuda().eval()\n",
|
|
"x = torch.randn(128, 3, 256, 256).cuda()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 3,
|
|
"id": "95fb5b20-95cd-4959-aa43-00a27769db5e",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"[INFO] Register count_convNd() for <class 'torch.nn.modules.conv.Conv2d'>.\n",
|
|
"[INFO] Register count_normalization() for <class 'torch.nn.modules.batchnorm.BatchNorm2d'>.\n",
|
|
"[INFO] Register zero_ops() for <class 'torch.nn.modules.activation.ReLU'>.\n",
|
|
"[INFO] Register zero_ops() for <class 'torch.nn.modules.pooling.MaxPool2d'>.\n",
|
|
"[INFO] Register count_upsample() for <class 'torch.nn.modules.upsampling.Upsample'>.\n",
|
|
"flops: 1095388.63 M, params: 1.76 M\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"flops, params = profile(model, (x,))\n",
|
|
"print('flops: %.2f M, params: %.2f M' % (flops / 1000000.0, params / 1000000.0))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "4a3cdf93-12a6-4d81-b32d-bcc4a47cb369",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"0.2345220708847046"
|
|
]
|
|
},
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"0.1172610354423523 * 2"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "fd7ce75e-85da-4366-a02c-cbe81b63fa43",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "469ac150-f997-43af-8ea7-8fa8dfbd9663",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "20426ce9-d7ab-4275-86ab-8dd09793c9c0",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "6ef8396c-41b7-444c-89bb-9652caac5bda",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"model"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "cmae",
|
|
"language": "python",
|
|
"name": "cmae"
|
|
},
|
|
"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.8.16"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|