예제 #1
0
if dataset == "50Salads":
    features = "SpatialCNN_" + granularity

import sys

noise_level = int(sys.argv[1])
print(noise_level)

# ------------------------------------------------------------------
# Evaluate using different filter lengths
if 1:
    # for conv in [5, 10, 15, 20]:
    # Initialize dataset loader & metrics
    data = datasets.Dataset(dataset, base_dir)
    trial_metrics = metrics.ComputeMetrics(overlap=.1, bg_class=bg_class)
    trial_metrics_30 = metrics.ComputeMetrics(overlap=.3, bg_class=bg_class)
    trial_metrics_50 = metrics.ComputeMetrics(overlap=.5, bg_class=bg_class)

    # Load data for each split
    for split in data.splits:
        if sensor_type == "video":
            feature_type = "A" if model_type != "SVM" else "X"
        else:
            feature_type = "S"

        X_train, y_train, X_test, y_test = data.load_split(
            features,
            split=split,
            sample_rate=video_rate,
            feature_type=feature_type)
conv = {'50Salads':25, "JIGSAWS":20, "MERL":5, "GTEA":25}[dataset]

# Which features for the given dataset
features = "SpatialCNN"
bg_class = 0 if dataset is not "JIGSAWS" else None

if dataset == "50Salads":
    features = "SpatialCNN_" + granularity

# ------------------------------------------------------------------
# Evaluate using different filter lengths
if 1:
# for conv in [5, 10, 15, 20]:
    # Initialize dataset loader & metrics
    data = datasets.Dataset(dataset, base_dir)
    trial_metrics = metrics.ComputeMetrics(overlap=.1, bg_class=bg_class)

    # Load data for each split
    for split in data.splits:
        if sensor_type=="video":
            feature_type = "A" if model_type != "SVM" else "X"
        else:
            feature_type = "S"

        X_train, y_train, X_test, y_test = data.load_split(features, split=split, 
                                                            sample_rate=video_rate, 
                                                            feature_type=feature_type)

        if trial_metrics.n_classes is None:
            trial_metrics.set_classes(data.n_classes)
# conv = {'50Salads':50, "JIGSAWS":20, "MERL":5, "GTEA":25}[dataset]

# Which features for the given dataset
features = "SpatialCNN"
bg_class = 0 if dataset is not "JIGSAWS" else None

if dataset == "50Salads":
    features = "SpatialCNN_" + granularity

# ------------------------------------------------------------------
# Evaluate using different filter lengths
if 1:
    # for conv in [5, 10, 15, 20]:
    # Initialize dataset loader & metrics
    data = datasets.Dataset(dataset, base_dir)
    trial_metrics = metrics.ComputeMetrics(overlap=.1, bg_class=bg_class)
    trial_metrics_train = metrics.ComputeMetrics(overlap=.1,
                                                 bg_class=bg_class,
                                                 task='train')

    # Load data for each split
    for split in data.splits:
        if sensor_type == "video":
            feature_type = "A" if model_type != "SVM" else "X"
        else:
            feature_type = "S"

        ## stops training after the first split
        if split != 'Split_1':
            print('terminate')
            sys.exit()