Team Ai
Apppublic

GoodWin/Deep-Multi-scale

sourceHugging Faceupdated 5y agoView on Hugging Face
0likes
base_options.cpython-38.pyc29 linesDownload Raw Back to __pycache__
1U

2�9_��@sFddlZddlZddlmZddlZddlZddlZGdd�d�ZdS)�N)�utilc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d3�ZdS)�BaseOptionscCs4d|_dS)NF)�initialized)�self�r�;/home/lxm/ExpCodes/GitDFDNet/DFDNet/options/base_options.py�__init__5szBaseOptions.__init__cCs|jdtddd�|jdtddd�|jdtd	d6d�|jdtdd
d�|jdtddd�|jdtddd�|jddtdd�|jdtddd�|jdtddd�|jddd d!�|jd"td#d$d�|jd%td&d'd�|jd(td)d*d�|jd+dd,d!�|jd-d.td/d�d0|_|S)1Nz--batchSize�zinput batch size)�type�default�helpz--ngf�@z$# of gen filters in first conv layerz	--gpu_ids�0z+gpu ids: e.g. 0  0,1,2, 0,2. use -1 for CPUz--nameZfacefh_dictionaryzDname of the experiment. It decides where to store samples and modelsz--modelZfaceDictz4chooses which model to use. cycle_gan, pix2pix, testz--which_directionZBtoAzAtoB or BtoAz7--nThreads�z# threads for loading data)rr8rz--checkpoints_dirz
./checkpointszmodels are saved herez--norm�instancez-instance normalization or batch normalizationz--serial_batchesZ9store_truezMif true, takes images in order to make batches, otherwise takes them randomly)�actionrz--resize_or_cropZdegradationzcscaling and cropping of images at load time [resize_and_crop|crop|scale_width|scale_width_and_crop]z--init_typeZkaimingz9network initialization [normal|xavier|kaiming|orthogonal]z--init_gaing{�G�z�?z1scaling factor for normal, xavier and orthogonal.z	--verbosez.if specified, print more debugging informationz--suffix�z`customized suffix: opt.name = opt.name + suffix: e.g., {model}_{which_model_netG}_size{loadSize}T)�add_argument�int�str�floatr)r�parserrrr�10initialize
s"zBaseOptions.initializecCs||jstjtjd�}|�|�}|��\}}|j}t�|�}|||j	�}|��\}}|j11}t�|�}|||j	�}||_|�
�S)N)Zformatter_class)r�argparseZArgumentParserZArgumentDefaultsHelpFormatterrZparse_known_args�model�modelsZget_option_setter�isTrainZdataset_mode�datarZ12parse_args)rr�opt�_Z13model_nameZmodel_option_setterZdataset_nameZdataset_option_setterrrr�gather_options!s�141516zBaseOptions.gather_optionsc17	Cs�d}|d7}tt|����D]F\}}d}|j�|�}||krHdt|�}|d�t|�t|�|�7}q|d7}t|�tj	�18|j|j�}t
�|�tj	�19|d�}t|d��}	|	�|�|	�d�W5QRXdS)	Nrz*----------------- Options ---------------20z	[default: %s]z{:>25}: {:<30}{}21z)----------------- End -------------------zopt.txtZwt�22)�sorted�vars�itemsrZget_defaultr�format�print�os�path�joinZcheckpoints_dir�namerZmkdirs�open�write)23rr�message�k�vZcommentrZexpr_dir�	file_nameZopt_filerrr�
print_options<s 2425zBaseOptions.print_optionscCs�|��}|j|_|jrF|jdkr6d|jjft|��nd}|j||_|j�d�}g|_|D] }t|�}|dkr\|j�	|�q\t26|j�dkr�tj�
|jd�||_|jS)Nrr�,r)r r�suffixr%r#r*�gpu_ids�splitr�append�len�torchZcudaZ27set_devicer)rrr3Zstr_idsZstr_id�idrrr�parsePs$zBaseOptions.parseN)�__name__�28__module__�__qualname__rrr r1r:rrrrr	s29r)rr'rr8rrrrrrr�<module>s