Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Add salinas dataset #8

Merged
merged 3 commits into from
Apr 7, 2020
Merged
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
20 changes: 20 additions & 0 deletions datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
'img': 'Pavia.mat',
'gt': 'Pavia_gt.mat'
},
'Salinas': {
'urls': ['http://www.ehu.eus/ccwintco/uploads/a/a3/Salinas_corrected.mat',
'http://www.ehu.eus/ccwintco/uploads/f/fa/Salinas_gt.mat'],
'img': 'Salinas_corrected.mat',
'gt': 'Salinas_gt.mat'
},
'PaviaU': {
'urls': ['http://www.ehu.eus/ccwintco/uploads/e/ee/PaviaU.mat',
'http://www.ehu.eus/ccwintco/uploads/5/50/PaviaU_gt.mat'],
Expand Down Expand Up @@ -138,6 +144,20 @@ def get_dataset(dataset_name, target_folder="./", datasets=DATASETS_CONFIG):

ignored_labels = [0]


elif dataset_name == 'Salinas':
img = open_file(folder + 'Salinas.mat')['Salinas_corrected']

rgb_bands = (43, 21, 11) # AVIRIS sensor

gt = open_file(folder + 'Salinas_gt.mat')['Salinas_gt']

label_values = ['Undefined','Brocoli_green_weeds_1', 'Brocoli_green_weeds_2','Fallow','Fallow_rough_plow','Fallow_smooth','Stubble','Celery',
'Grapes_untrained','Soil_vinyard_develop','Corn_senesced_green_weeds','Lettuce_romaine_4wk','Lettuce_romaine_5wk','Lettuce_romaine_6wk',
'Lettuce_romaine_7wk','Vinyard_untrained','Vinyard_vertical_trellis']

ignored_labels = [0]

elif dataset_name == 'IndianPines':
# Load the image
img = open_file(folder + 'Indian_pines_corrected.mat')
Expand Down
3 changes: 1 addition & 2 deletions inference.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Python 2/3 compatiblity
from __future__ import print_function
from __future__ import division

import joblib
import os
from utils import convert_to_color_, convert_from_color_, get_device
from datasets import open_file
Expand Down Expand Up @@ -91,7 +91,6 @@ def convert_from_color(x):
return convert_from_color_(x, palette=invert_palette)

if MODEL in ['SVM', 'SVM_grid', 'SGD', 'nearest']:
from sklearn.externals import joblib
model = joblib.load(CHECKPOINT)
w, h = img.shape[:2]
X = img.reshape((w*h, N_BANDS))
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ scikit-image>=0.13.1
torch>=0.4.0
matplotlib>=2.0.2
torchsummary>=1.5
joblib==0.14.1