| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- import argparse
- import torch
- import torchvision.models
- import sys
- import pandas
-
-
-
- '''
- filename:train_model_1.0.py
- create date: 11/17/2020 Tue
- Author: Jeong Geol Kim
- Contact: atarib4816@gmail.com
- Description: This .py file will train, save weight and save Results with parameters. parameters will input by .txt file.
- eg) train_model_1.0.py -r train_parameter.lcfg
- guidelines for train_parameter.txt
- filename format: partofarchitecture_backbone_yymmdd.lcfg
- eg) shapesort_mobilenetv2_201118.txt
- '''
-
-
- def Params_Set():
- '''
- Description: read options from .lcfg and initialize learning options.
- You should write
- '''
- HELP_TEXT = "how to use .py" #TODO: write description more precisely
- N_OF_PARAMS = 3 #from now on, .txt file has 3 pramas(backbone Name, iterations, save period)
-
- parser = argparse.ArgumentParser(description = HELP_TEXT)
- parser.add_argument("-r", required = True, help = '.lcfg file contains with learning configures')
- args = parser.parse_args()
-
- f = open(args.r, 'r')
- p_string = f.readline()
- f.close()
- params = p_string.split()
-
- if str(args.r[-4:]) != 'lcfg':
- print ("Error: {} is wrong filename extension. Learning configures must written in .lcfg file")
- return
- elif len(params) != N_OF_PARAMS:
- print("Error: {} is broken. please check learning configures.".format(args.r))
- return
- else:
- print("---Learning Options---")
- print("Backbone Name: {}".format(params[0]))
- print("Number of iterations: {}".format(params[1]))
- print("Period of saving weight: {}".format(params[2]))
- return params, args.r
-
-
- def Preprocess():
- pass
-
-
-
- def Model_Construct():
- pass
-
- def Train():
- pass
-
- def Save_Weight():
- pass
-
-
- def Result():
- pass
-
-
-
-
- if __name__ == "__main__":
- #get all params from option files
- params, name_of_lcfg = Params_Set()
-
- Preprocess()
-
- Model_Construct()
-
- Train()
-
- Save_Weight()
-
- Result()
-
-
-
-
|