Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions classification/main_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ def main():
model = DenseNet169(n_inputs, numCls)
elif args.model == 'DenseNet201':
model = DenseNet201(n_inputs, numCls)
elif args.model == 'DenseNet201':
model = DenseNet201(n_inputs, numCls)
# finetune moco pre-trained model
elif args.model.startswith("Moco"):
pt_path = os.path.join(args.pt_dir, f"{args.pt_name}_{args.pt_type}_converted.pth")
Expand Down
15 changes: 15 additions & 0 deletions classification/models/ResNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,23 @@ def __init__(self, mocoModel, n_inputs = 12, numCls = 17):
resnet.conv1 = nn.Conv2d(n_inputs, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
resnet.load_state_dict(mocoModel["state_dict"])

<<<<<<< HEAD
# (testing) -- match the layer adding from moco's conv1 layer in ResNet
self.Conv1x1Block = nn.Sequential(
nn.Conv2d(n_inputs, 3, kernel_size=1, stride=1, bias=False),
nn.BatchNorm2d(3),
nn.ReLU(inplace=True)
)

# self.conv1 = nn.Conv2d(n_inputs, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
self.conv1 = nn.Conv2d(3, 64, kernel_size=(256, 256), stride=(2, 2), padding=(3, 3), bias=False)
self.encoder = nn.Sequential(
self.Conv1x1Block,
self.conv1,
=======
self.encoder = nn.Sequential(
resnet.conv1,
>>>>>>> origin/master
resnet.bn1,
resnet.relu,
resnet.maxpool,
Expand Down
10 changes: 8 additions & 2 deletions classification/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from dataset import SEN12MS, ToTensor, Normalize
from models.VGG import VGG16, VGG19
from models.ResNet import ResNet50, ResNet101, ResNet152
from models.ResNet import ResNet50, ResNet101, ResNet152, Moco
from models.DenseNet import DenseNet121, DenseNet161, DenseNet169, DenseNet201
from metrics import MetricTracker, Precision_score, Recall_score, F1_score, \
F2_score, Hamming_loss, Subset_accuracy, Accuracy_score, One_error, \
Expand All @@ -25,6 +25,7 @@
model_choices = ['VGG16', 'VGG19',
'ResNet50','ResNet101','ResNet152',
'DenseNet121','DenseNet161','DenseNet169','DenseNet201', 'Moco']

label_choices = ['multi_label', 'single_label']

# ------------------------ define and parse arguments -------------------------
Expand Down Expand Up @@ -158,7 +159,12 @@ def main():
elif config['model'] == 'DenseNet169':
model = DenseNet169(n_inputs, numCls)
elif config['model'] == 'DenseNet201':
model = DenseNet201(n_inputs, numCls)
model = DenseNet201(n_inputs, numCls)

# add moco adjusted model - conv1 layer part
elif config['model'] == 'Moco':
model = Moco(n_inputs, numCls)

else:
raise NameError("no model")

Expand Down
19 changes: 19 additions & 0 deletions evaluation_assessment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. The difference evaluation options:
> - a. Land cover classification -- image classificaiton.
> - b. Semantic Segmentation -- assigning a class label to every pixel of the input image.

2.

3. tmp
> a. SEN12MS - Supervised Learning Benchmark - Classification

| Backbone | Land Type | Modalitities | Bactch size | Epochs | Accuracy (%) | Macro-F1 (%) | Micro-F1 (%) |
|---|---|---|---|---|---|---|---|
|DenseNet|single-label|_s1s2|64|100|51.16|50.78|62.90|
|DenseNet|single-label|_s2|64|100|54.41|52.32|64.74|
|ResNet50|single-label|_RGB|64|100|45.11|45.16|58.98|
|ResNet50|single-label|_s1s2|64|100|45.52|53.21|64.66|
|ResNet50|single-label|_s2|64|100|57.33|53.39|66.35|
|ResNet50|multi-label|_RGB|64|100|89.86|47.57|66.51|
|ResNet50|multi-label|_s1s2|64|100|91.22|57.46|71.40|
|ResNet50|multi-label|_s2|64|100|90.62|56.14|69.88|