<gh_stars>1-10
# coding=utf-8

import torch
from thop import profile
from thop import clever_format
from torchstat import stat

from backbone.ghostnet import ghostnet
from models.seg_resnet import *
from models.seg_ghostnet import *
from models.seg_ghostnet_decouple import *
from models.seg_ghostnet_decouple_score import *

from models.previous.psp_net import *
from models.previous.psp_net_vgg import *
from models.previous.deeplabv3_plus import *
from models.previous.fcn import *
from models.previous.u_net import *
from models.previous.seg_net import *

# model = SegGhostNet1p0(num_class=6)
# ===========================================================================================================================================================================================
# Total params: 2,767,252
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 230.94MB
# Total MAdd: 2.84GMAdd
# Total Flops: 1.44GFlops
# Total MemR+W: 473.98MB

# model = SegGhostNetDecouple1p0(num_class=6)
# ===========================================================================================================================================================================================
# Total params: 2,822,393
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 265.54MB
# Total MAdd: 4.33GMAdd
# Total Flops: 2.19GFlops
# Total MemR+W: 550.22MB

# model = SegGhostNetDecoupleScore1p0(num_class=6)
# ===========================================================================================================================================================================================
# Total params: 2,833,409
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 271.54MB
# Total MAdd: 4.69GMAdd
# Total Flops: 2.37GFlops
# Total MemR+W: 559.26MB

# model = SegNet(num_class=6)
# ==================================================================================================================================================================
# Total params: 39,792,082
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1700.50MB
# Total MAdd: 468.3GMAdd
# Total Flops: 216.91GFlops
# Total MemR+W: 3.18GB

# model = UNet(num_class=6)
# ==================================================================================================================================================================
# Total params: 31,043,846
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1093.70MB
# Total MAdd: 224.97GMAdd
# Total Flops: 108.61GFlops
# Total MemR+W: 2.2GB

# model = FCN8s(num_class=6)
# ==================================================================================================================================================================
# Total params: 134,300,114
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1135.32MB
# Total MAdd: 379.63GMAdd
# Total Flops: 190.01GFlops
# Total MemR+W: 2.7GB

# model = FCN16s(num_class=6)
# =================================================================================================================================================================
# Total params: 134,325,644
# -----------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1134.79MB
# Total MAdd: 379.6GMAdd
# Total Flops: 190.0GFlops
# Total MemR+W: 2.69GB

# model = FCNs(num_class=6)
# ==========================================================================================================================================================================
# Total params: 18,643,878
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 732.50MB
# Total MAdd: 171.5GMAdd
# Total Flops: 80.44GFlops
# Total MemR+W: 1.39GB

# model = DeepLabV3plus(num_class=6)
# ==================================================================================================================================================================================
# Total params: 54,701,462
# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1470.64MB
# Total MAdd: 165.86GMAdd
# Total Flops: 83.04GFlops
# Total MemR+W: 3.1GB

model = PSPNetVGG16(num_class=6)

stat(model, (3, 512, 512))

# flops, params = profile(model, inputs=(torch.randn(1, 3, 512, 512),))
# flops, params = clever_format([flops, params], "%.3f")
# print('model: {}, flops: {}, params: {}'.format(model.__class__.__name__, flops, params))

# coding=utf-8

import torch
from thop import profile
from thop import clever_format
from torchstat import stat

from backbone.ghostnet import ghostnet
from models.seg_resnet import *
from models.seg_ghostnet import *
from models.seg_ghostnet_decouple import *
from models.seg_ghostnet_decouple_score import *

from models.previous.psp_net import *
from models.previous.psp_net_vgg import *
from models.previous.deeplabv3_plus import *
from models.previous.fcn import *
from models.previous.u_net import *
from models.previous.seg_net import *

# model = SegGhostNet1p0(num_class=6)
# ===========================================================================================================================================================================================
# Total params: 2,767,252
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 230.94MB
# Total MAdd: 2.84GMAdd
# Total Flops: 1.44GFlops
# Total MemR+W: 473.98MB

# model = SegGhostNetDecouple1p0(num_class=6)
# ===========================================================================================================================================================================================
# Total params: 2,822,393
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 265.54MB
# Total MAdd: 4.33GMAdd
# Total Flops: 2.19GFlops
# Total MemR+W: 550.22MB

# model = SegGhostNetDecoupleScore1p0(num_class=6)
# ===========================================================================================================================================================================================
# Total params: 2,833,409
# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 271.54MB
# Total MAdd: 4.69GMAdd
# Total Flops: 2.37GFlops
# Total MemR+W: 559.26MB

# model = SegNet(num_class=6)
# ==================================================================================================================================================================
# Total params: 39,792,082
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1700.50MB
# Total MAdd: 468.3GMAdd
# Total Flops: 216.91GFlops
# Total MemR+W: 3.18GB

# model = UNet(num_class=6)
# ==================================================================================================================================================================
# Total params: 31,043,846
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1093.70MB
# Total MAdd: 224.97GMAdd
# Total Flops: 108.61GFlops
# Total MemR+W: 2.2GB

# model = FCN8s(num_class=6)
# ==================================================================================================================================================================
# Total params: 134,300,114
# ------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1135.32MB
# Total MAdd: 379.63GMAdd
# Total Flops: 190.01GFlops
# Total MemR+W: 2.7GB

# model = FCN16s(num_class=6)
# =================================================================================================================================================================
# Total params: 134,325,644
# -----------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1134.79MB
# Total MAdd: 379.6GMAdd
# Total Flops: 190.0GFlops
# Total MemR+W: 2.69GB

# model = FCNs(num_class=6)
# ==========================================================================================================================================================================
# Total params: 18,643,878
# --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 732.50MB
# Total MAdd: 171.5GMAdd
# Total Flops: 80.44GFlops
# Total MemR+W: 1.39GB

# model = DeepLabV3plus(num_class=6)
# ==================================================================================================================================================================================
# Total params: 54,701,462
# ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Total memory: 1470.64MB
# Total MAdd: 165.86GMAdd
# Total Flops: 83.04GFlops
# Total MemR+W: 3.1GB

model = PSPNetVGG16(num_class=6)

stat(model, (3, 512, 512))

# flops, params = profile(model, inputs=(torch.randn(1, 3, 512, 512),))
# flops, params = clever_format([flops, params], "%.3f")
# print('model: {}, flops: {}, params: {}'.format(model.__class__.__name__, flops, params))
# coding=utf-8 # model = SegGhostNet1p0(num_class=6) # =========================================================================================================================================================================================== # Total params: 2,767,252 # ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Total memory: 230.94MB # Total MAdd: 2.84GMAdd # Total Flops: 1.44GFlops # Total MemR+W: 473.98MB # model = SegGhostNetDecouple1p0(num_class=6) # =========================================================================================================================================================================================== # Total params: 2,822,393 # ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Total memory: 265.54MB # Total MAdd: 4.33GMAdd # Total Flops: 2.19GFlops # Total MemR+W: 550.22MB # model = SegGhostNetDecoupleScore1p0(num_class=6) # =========================================================================================================================================================================================== # Total params: 2,833,409 # ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Total memory: 271.54MB # Total MAdd: 4.69GMAdd # Total Flops: 2.37GFlops # Total MemR+W: 559.26MB # model = SegNet(num_class=6) # ================================================================================================================================================================== # Total params: 39,792,082 # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # Total memory: 1700.50MB # Total MAdd: 468.3GMAdd # Total Flops: 216.91GFlops # Total MemR+W: 3.18GB # model = UNet(num_class=6) # ================================================================================================================================================================== # Total params: 31,043,846 # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # Total memory: 1093.70MB # Total MAdd: 224.97GMAdd # Total Flops: 108.61GFlops # Total MemR+W: 2.2GB # model = FCN8s(num_class=6) # ================================================================================================================================================================== # Total params: 134,300,114 # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # Total memory: 1135.32MB # Total MAdd: 379.63GMAdd # Total Flops: 190.01GFlops # Total MemR+W: 2.7GB # model = FCN16s(num_class=6) # ================================================================================================================================================================= # Total params: 134,325,644 # ----------------------------------------------------------------------------------------------------------------------------------------------------------------- # Total memory: 1134.79MB # Total MAdd: 379.6GMAdd # Total Flops: 190.0GFlops # Total MemR+W: 2.69GB # model = FCNs(num_class=6) # ========================================================================================================================================================================== # Total params: 18,643,878 # -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Total memory: 732.50MB # Total MAdd: 171.5GMAdd # Total Flops: 80.44GFlops # Total MemR+W: 1.39GB # model = DeepLabV3plus(num_class=6) # ================================================================================================================================================================================== # Total params: 54,701,462 # ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Total memory: 1470.64MB # Total MAdd: 165.86GMAdd # Total Flops: 83.04GFlops # Total MemR+W: 3.1GB # flops, params = profile(model, inputs=(torch.randn(1, 3, 512, 512),)) # flops, params = clever_format([flops, params], "%.3f") # print('model: {}, flops: {}, params: {}'.format(model.__class__.__name__, flops, params))