Skip to content

Commit 4d9416e

Browse files
authored
Merge pull request #6 from jangsoopark/v2.0.0
V2.0.0
2 parents 123a4c3 + 57b5c47 commit 4d9416e

File tree

8 files changed

+133
-31
lines changed

8 files changed

+133
-31
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,14 @@ $RECYCLE.BIN/
282282
# asdf
283283
dataset/soc/raw/train/
284284
dataset/soc/raw/test/
285-
286285
dataset/soc/train/
287286
dataset/soc/test/
287+
288+
dataset/eoc-1/raw/train/
289+
dataset/eoc-1/raw/test/
290+
dataset/eoc-1/train/
291+
dataset/eoc-1/test/
292+
288293
experiments/history
289294

290295
*.pth

README.md

+60-8
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ You can see the details in `src/model/_base.py` and `experiments/config/AConvNet
6161
## Experiments
6262

6363
You can download the MSTAR Dataset from [MSTAR Overview](https://www.sdms.afrl.af.mil/index.php?collection=mstar)
64+
- MSTAR Clutter - CD1 / CD2
65+
- MSTAR Target Chips (T72 BMP2 BTR70 SLICY) - CD1
66+
- MSTAR / IU Mixed Targets - CD1 / CD2
67+
- MSTAR / IU T-72 Variants - CD1 / CD2
68+
- MSTAR Predictlite Software - CD1
6469

65-
### Standard Operating Condition (SOC)
6670

67-
- MSTAR Target Chips (T72 BMP2 BTR70 SLICY) which is **MSTAR-PublicTargetChips-T72-BMP2-BTR70-SLICY.zip**
68-
- MSTAR / IU Mixed Targets which consists of **MSTAR-PublicMixedTargets-CD1.zip** and **MSTAR-PublicMixedTargets-CD2.zip**
69-
- **SLICY target is ignored**
71+
### Standard Operating Condition (SOC)
7072

7173
| | | Train | | Test | |
7274
| ------- | ---------- | ---------- | ---------- | ---------- | ---------- |
@@ -82,7 +84,7 @@ You can download the MSTAR Dataset from [MSTAR Overview](https://www.sdms.afrl.a
8284
| ZIL-131 | E12 | 17 | 299 | 15 | 274 |
8385
| ZSU-234 | d08 | 17 | 299 | 15 | 274 |
8486

85-
#### Training Set (Depression: 17$\degree$)
87+
#### Training Set (Depression: 17$\degree$)
8688

8789
```shell
8890
MSTAR-PublicTargetChips-T72-BMP2-BTR70-SLICY
@@ -107,7 +109,7 @@ MSTAR-PublicMixedTargets-CD2/MSTAR_PUBLIC_MIXED_TARGETS_CD2
107109

108110
```
109111

110-
#### Test Set (Depression: 15$\degree$​​)
112+
#### Test Set (Depression: 15$\degree$)
111113

112114
```shell
113115
MSTAR-PublicTargetChips-T72-BMP2-BTR70-SLICY
@@ -139,8 +141,8 @@ MSTAR-PublicMixedTargets-CD1/MSTAR_PUBLIC_MIXED_TARGETS_CD1
139141
- Place the two directories (`train` and `test`) to the `dataset/raw`.
140142
```shell
141143
$ cd src/data
142-
$ python3 generate_dataset.py --is_train=True --use_phase=True
143-
$ python3 generate_dataset.py --is_train=False --use_phase=True
144+
$ python3 generate_dataset.py --is_train=True --use_phase=True --chip_size=94 --dataset=soc
145+
$ python3 generate_dataset.py --is_train=False --use_phase=True --dataset=soc
144146
$ cd ..
145147
$ python3 train.py
146148
```
@@ -169,6 +171,56 @@ $ python3 train.py
169171

170172
### Extended Operating Conditions (EOC)
171173

174+
#### EOC-1 (Large depression angle change)
175+
176+
177+
| | Train | | | Test | | |
178+
| ------- | ---------- | ---------- | ---------- | ---------- | ---------- | ---------- |
179+
| Class | Serial No. | Depression | No. Images | Serial No. | Depression | No. Images |
180+
| T-72 | 132 | 17 | 232 | A64 | 30 | 196 |
181+
| 2S1 | b01 | 17 | 299 | b01 | 30 | 274 |
182+
| BRDM-2 | E-71 | 17 | 298 | E-71 | 30 | 274 |
183+
| ZSU-234 | d08 | 17 | 299 | d08 | 30 | 274 |
184+
185+
```shell
186+
MSTAR-PublicTargetChips-T72-BMP2-BTR70-SLICY/MSTAR_PUBLIC_TARGETS_CHIPS_T72_BMP2_BTR70_SLICY
187+
├ TRAIN/17_DEG
188+
│ └ T72/SN_132/*.015 (232 images)
189+
└ ...
190+
191+
MSTAR-PublicMixedTargets-CD2/MSTAR_PUBLIC_MIXED_TARGETS_CD2
192+
├ 17_DEG
193+
│ └ COL2/SCENE1
194+
│ ├ 2S1/*.000 (299 images)
195+
│ ├ BRDM_2/*.001 (298 images)
196+
│ └ ZSU_23_4/*.026 (299 images)
197+
└ ...
198+
199+
```
200+
201+
#### Test Set (Depression: 30$\degree$)
202+
203+
```shell
204+
MSTAR-PublicT72Variants-CD2/MSTAR_PUBLIC_T_72_VARIANTS_CD2
205+
├ 30_DEG/COL2/SCENE1
206+
│ └ A64/*.024 (288 images)
207+
└ ...
208+
209+
MSTAR-PublicMixedTargets-CD2/MSTAR_PUBLIC_MIXED_TARGETS_CD2
210+
├ 30_DEG
211+
│ └ COL2/SCENE1
212+
│ ├ 2S1/*.000 (288 images)
213+
│ ├ BRDM_2/*.001 (287 images)
214+
│ ├ ZSU_23_4/*.026 (288 images)
215+
│ └ ...
216+
└ ...
217+
218+
```
219+
- Train Target: 2S1, BRDM2, T72, ZSU234 with depression angle 17$\degree$
220+
- Test Target: 2S1, BRDM2, T72, ZSU234 with depression angle 30$\degree$
221+
222+
#### EOC-2 (Target configuration and version variants)
223+
172224
### Outlier Rejection
173225

174226
### End-to-End SAR-ATR Cases

dataset/eoc-1/raw/rename.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import glob
2+
import os
3+
4+
5+
target_list = glob.glob('./*/*')
6+
7+
for name in target_list:
8+
print(name, name.replace('_', ''))
9+
os.rename(name, name.replace('_', ''))
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"model_name": "AConvNet-EOC-1",
3+
"dataset": "eoc-1",
4+
"num_classes": 4,
5+
"channels": 2,
6+
"batch_size": 100,
7+
"epochs": 50,
8+
"momentum": 0.9,
9+
"lr": 1e-3,
10+
"lr_step": [14],
11+
"lr_decay": 0.1,
12+
"weight_decay": 4e-3,
13+
"dropout_rate": 0.5
14+
}

notebook/experiments-SOC.ipynb

+8-8
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
"name": "stderr",
146146
"output_type": "stream",
147147
"text": [
148-
"load test data set: 2425it [00:01, 2086.92it/s]\n",
148+
"load test data set: 2425it [00:18, 134.26it/s]\n",
149149
"d:\\ivs\\project\\004-research\\signal-processing\\image-processing\\remote-sensing\\aconvnet\\aconvnet-pytorch\\venv\\lib\\site-packages\\torch\\nn\\functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at ..\\c10/core/TensorImpl.h:1156.)\n",
150150
" return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)\n"
151151
]
@@ -288,7 +288,7 @@
288288
},
289289
{
290290
"cell_type": "code",
291-
"execution_count": 105,
291+
"execution_count": 14,
292292
"metadata": {},
293293
"outputs": [],
294294
"source": [
@@ -305,7 +305,7 @@
305305
" for _ in range(n)\n",
306306
" ])\n",
307307
" noise = noise * portions\n",
308-
" \n",
308+
" \n",
309309
" return _images + noise.astype(np.float32)\n",
310310
"\n",
311311
"\n",
@@ -335,17 +335,17 @@
335335
},
336336
{
337337
"cell_type": "code",
338-
"execution_count": 106,
338+
"execution_count": 15,
339339
"metadata": {},
340340
"outputs": [
341341
{
342342
"name": "stdout",
343343
"output_type": "stream",
344344
"text": [
345-
"ratio = 0.01, accuracy = 98.23\n",
346-
"ratio = 0.05, accuracy = 94.19\n",
347-
"ratio = 0.10, accuracy = 85.28\n",
348-
"ratio = 0.15, accuracy = 73.40\n"
345+
"ratio = 0.01, accuracy = 98.52\n",
346+
"ratio = 0.05, accuracy = 94.56\n",
347+
"ratio = 0.10, accuracy = 85.11\n",
348+
"ratio = 0.15, accuracy = 73.11\n"
349349
]
350350
}
351351
],

src/data/generate_dataset.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,22 @@
1515
flags.DEFINE_string('dataset', default='soc', help='')
1616
flags.DEFINE_boolean('is_train', default=True, help='')
1717
flags.DEFINE_boolean('use_phase', default=False, help='')
18+
flags.DEFINE_integer('chip_size', default=94, help='')
1819
FLAGS = flags.FLAGS
1920

2021
project_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
2122

2223

23-
def generate(src_path, dst_path, is_train, use_phase):
24+
def generate(src_path, dst_path, is_train, use_phase, chip_size, dataset):
25+
if not os.path.exists(src_path):
26+
return
2427
if not os.path.exists(dst_path):
2528
os.makedirs(dst_path, exist_ok=True)
2629
print(f'Target Name: {os.path.basename(dst_path)}')
2730

28-
_mstar = mstar.MSTAR(is_train=is_train, use_phase=use_phase, patch_size=88, stride=1)
31+
_mstar = mstar.MSTAR(
32+
name=dataset, is_train=is_train, use_phase=use_phase, chip_size=chip_size, patch_size=88, stride=1
33+
)
2934

3035
image_list = glob.glob(os.path.join(src_path, '*'))
3136

@@ -52,8 +57,8 @@ def main(_):
5257
(
5358
os.path.join(raw_root, mode, target),
5459
os.path.join(output_root, target),
55-
FLAGS.is_train, FLAGS.use_phase
56-
) for target in mstar.target_name
60+
FLAGS.is_train, FLAGS.use_phase, FLAGS.chip_size, FLAGS.dataset
61+
) for target in mstar.target_name_soc
5762
]
5863

5964
with Pool(10) as p:

src/data/mstar.py

+26-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,32 @@
66
import glob
77
import os
88

9-
target_name = ('2S1', 'BMP2', 'BRDM2', 'BTR60', 'BTR70', 'D7', 'T62', 'T72', 'ZIL131', 'ZSU234')
10-
serial_number = ('b01', '9563', 'E-71', 'k10yt7532', 'c71', '92v13015', 'A51', '132', 'E12', 'd08')
9+
target_name_soc = ('2S1', 'BMP2', 'BRDM2', 'BTR60', 'BTR70', 'D7', 'T62', 'T72', 'ZIL131', 'ZSU234')
10+
target_name_eoc_1 = ('2S1', 'BRDM2', 'T72', 'ZSU234')
11+
serial_number = {
12+
'b01': 0,
13+
'9563': 1,
14+
'E-71': 2,
15+
'k10yt7532': 3,
16+
'c71': 4,
17+
'92v13015': 5,
18+
'A51': 6,
19+
20+
'132': 7,
21+
'A64': 7,
22+
23+
'E12': 8,
24+
'd08': 9
25+
}
1126

1227

1328
class MSTAR(object):
1429

15-
def __init__(self, is_train=False, use_phase=False, patch_size=88, stride=40):
30+
def __init__(self, name='soc', is_train=False, use_phase=False, chip_size=94, patch_size=88, stride=40):
31+
self.name = name
1632
self.is_train = is_train
1733
self.use_phase = use_phase
34+
self.chip_size = chip_size
1835
self.patch_size = patch_size
1936
self.stride = stride
2037

@@ -74,22 +91,22 @@ def _center_crop(data, size=128):
7491

7592
return data[y: y + size, x: x + size]
7693

77-
@staticmethod
78-
def _data_augmentation(data, patch_size=88, stride=40):
94+
def _data_augmentation(self, data, patch_size=88, stride=40):
7995
# patch extraction
80-
_data = MSTAR._center_crop(data, size=94)
96+
_data = MSTAR._center_crop(data, size=self.chip_size)
8197
_, _, channels = _data.shape
8298
patches = shape.view_as_windows(_data, window_shape=(patch_size, patch_size, channels), step=stride)
8399
patches = patches.reshape(-1, patch_size, patch_size, channels)
84100
return patches
85101

86-
@staticmethod
87-
def _extract_meta_label(header):
102+
def _extract_meta_label(self, header):
88103

89104
target_type = header['TargetType']
90105
sn = header['TargetSerNum']
91106

92-
class_id = serial_number.index(sn)
107+
class_id = serial_number[sn]
108+
if self.name == 'eoc-1':
109+
class_id = target_name_eoc_1.index(target_name_soc[class_id])
93110

94111
azimuth_angle = MSTAR._get_azimuth_angle(header['TargetAz'])
95112

src/train.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
flags.DEFINE_string('config_name', 'config/AConvNet-SOC.json', help='')
2323
FLAGS = flags.FLAGS
2424

25-
common.set_random_seed(12321)
25+
#common.set_random_seed(12321)
2626

2727

2828
def load_dataset(path, is_train, name, batch_size):

0 commit comments

Comments
 (0)