-
Notifications
You must be signed in to change notification settings - Fork 22
/
install_data_and_model.py
41 lines (30 loc) · 1.64 KB
/
install_data_and_model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
from __future__ import print_function
import zipfile
import os, sys
from config import cfg
def create_mappings(folder_path):
sys.path.append(os.path.join(folder_path, "..", "..", "Detection", "utils", "annotations"))
from annotations_helper import create_class_dict, create_map_files
abs_path = os.path.dirname(os.path.abspath(__file__))
data_set_path = os.path.join(abs_path, cfg["CNTK"].MAP_FILE_PATH)
class_dict = create_class_dict(data_set_path)
create_map_files(data_set_path, class_dict, training_set=True)
create_map_files(data_set_path, class_dict, training_set=False)
if __name__ == '__main__':
base_folder = os.path.dirname(os.path.abspath(__file__))
#downloads pretrained model pointed out in config.py that will be used for transfer learning
sys.path.append(os.path.join(base_folder, "..", "..", "PretrainedModels"))
from models_util import download_model_by_name
download_model_by_name(cfg["CNTK"].BASE_MODEL)
#downloads hotel pictures classificator dataset (HotailorPOC2)
#comment out lines bellow if you're using a custom dataset
sys.path.append(os.path.join(base_folder, "..", "..", "DataSets", "HotailorPOC2"))
from download_HotailorPOC2_dataset import download_dataset
download_dataset()
#generates metadata for dataset required by FasterRCNN.py script
print("Creating mapping files for data set..")
create_mappings(base_folder)