-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
efficientnet not complete, will come back
- Loading branch information
1 parent
b2e7ab2
commit 83d4ae0
Showing
4 changed files
with
131 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import torch | ||
import numpy as np | ||
from gradipy.tensor import Tensor | ||
import gradipy.nn as nn | ||
import gradipy.nn.functional as F | ||
|
||
|
||
def load_weights_from_pytorch(path="./weights/efficientnet-b0-355c32eb.pth"): | ||
state_dict = torch.load(path) | ||
for key, value in state_dict.items(): | ||
print(f"Key: {key}, --> Tensor Shape: {value.shape}") | ||
|
||
|
||
batch_norm_momentum = 0.9 | ||
batch_norm_epsilon = 1e-5 | ||
has_se = None | ||
id_skip = None | ||
inp = 3 | ||
oup = 1000 | ||
image_size = 224 | ||
|
||
|
||
class MBConvBlock(nn.Module): | ||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
|
||
if __name__ == "__main__": | ||
load_weights_from_pytorch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
blocks_args = [ | ||
{ | ||
"num_repeat": 1, | ||
"kernel_size": 3, | ||
"stride": [1], | ||
"expand_ratio": 1, | ||
"input_filters": 32, | ||
"output_filters": 16, | ||
"se_ratio": 0.25, | ||
"id_skip": True, | ||
}, | ||
{ | ||
"num_repeat": 2, | ||
"kernel_size": 3, | ||
"stride": [2], | ||
"expand_ratio": 6, | ||
"input_filters": 16, | ||
"output_filters": 24, | ||
"se_ratio": 0.25, | ||
"id_skip": True, | ||
}, | ||
{ | ||
"num_repeat": 2, | ||
"kernel_size": 5, | ||
"stride": [2], | ||
"expand_ratio": 6, | ||
"input_filters": 24, | ||
"output_filters": 40, | ||
"se_ratio": 0.25, | ||
"id_skip": True, | ||
}, | ||
{ | ||
"num_repeat": 3, | ||
"kernel_size": 3, | ||
"stride": [2], | ||
"expand_ratio": 6, | ||
"input_filters": 40, | ||
"output_filters": 80, | ||
"se_ratio": 0.25, | ||
"id_skip": True, | ||
}, | ||
{ | ||
"num_repeat": 3, | ||
"kernel_size": 5, | ||
"stride": [1], | ||
"expand_ratio": 6, | ||
"input_filters": 80, | ||
"output_filters": 112, | ||
"se_ratio": 0.25, | ||
"id_skip": True, | ||
}, | ||
{ | ||
"num_repeat": 4, | ||
"kernel_size": 5, | ||
"stride": [2], | ||
"expand_ratio": 6, | ||
"input_filters": 112, | ||
"output_filters": 192, | ||
"se_ratio": 0.25, | ||
"id_skip": True, | ||
}, | ||
{ | ||
"num_repeat": 1, | ||
"kernel_size": 3, | ||
"stride": [1], | ||
"expand_ratio": 6, | ||
"input_filters": 192, | ||
"output_filters": 320, | ||
"se_ratio": 0.25, | ||
"id_skip": True, | ||
}, | ||
] | ||
|
||
global_params = { | ||
"width_coefficient": 1.0, | ||
"depth_coefficient": 1.0, | ||
"image_size": 224, | ||
"dropout_rate": 0.2, | ||
"num_classes": 1000, | ||
"batch_norm_momentum": 0.99, | ||
"batch_norm_epsilon": 0.001, | ||
"drop_connect_rate": 0.2, | ||
"depth_divisor": 8, | ||
"min_depth": None, | ||
"include_top": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters