MHasanUnical commited on
Commit
7fac932
·
verified ·
1 Parent(s): bf509b5

Upload model.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. model.py +5 -2
model.py CHANGED
@@ -4,12 +4,14 @@ import torch.nn as nn
4
  import torchvision
5
  import torch.nn.functional as F
6
  from torchvision.transforms import functional as FF
 
7
 
8
  ######################################################################
9
  # Configuration File
10
  ######################################################################
11
- class VesselSegmentConfig:
12
- def __init__(self, num_classes, input_channels, image_size, features, attention_dims, patch_size, batch_size):
 
13
  self.num_classes = num_classes
14
  self.input_channels = input_channels
15
  self.image_size = image_size
@@ -17,6 +19,7 @@ class VesselSegmentConfig:
17
  self.attention_dims = attention_dims
18
  self.patch_size = patch_size
19
  self.batch_size = batch_size
 
20
 
21
  ######################################################################
22
  # IMAGE DOWN SAMPLING
 
4
  import torchvision
5
  import torch.nn.functional as F
6
  from torchvision.transforms import functional as FF
7
+ from transformers import PretrainedConfig
8
 
9
  ######################################################################
10
  # Configuration File
11
  ######################################################################
12
+ class VesselSegmentConfig(PretrainedConfig):
13
+ model_type = "SegformerForSemanticSegmentation"
14
+ def __init__(self, num_classes, input_channels, image_size, features, attention_dims, patch_size, batch_size, **kwargs):
15
  self.num_classes = num_classes
16
  self.input_channels = input_channels
17
  self.image_size = image_size
 
19
  self.attention_dims = attention_dims
20
  self.patch_size = patch_size
21
  self.batch_size = batch_size
22
+ super().__init__(**kwargs)
23
 
24
  ######################################################################
25
  # IMAGE DOWN SAMPLING