def __init__(self, parser=None): print('Training directory: ', self.train_dir) print('Test directory: ', self.test_dir) print('Transfer learning directory: ', self.transfer_dir) print('Data save directory: ', self.save_dir) print() init_params(self.d, parser=parser)
import numpy as np import cv2 import initialization as init tc = init.init_params() def find_nearest(self, a): A = np.asarray(self) idx = (np.abs(A - a)).argmin() return A[idx], idx #SENSOR-PLANE DESIGN based on SENSOR REGION WIDTH, CLASS/LABEL-SIZE and NUMBER of DETECTORS def sensorplane_geometry(): fl_num_det_row = int(np.floor(tc.NUM_CLASS**(0.5))) ce_num_det_row = int(np.ceil(tc.NUM_CLASS**(0.5))) choices = np.asarray([fl_num_det_row, ce_num_det_row]) square_arrgmnt = choices**2 remain_det = np.abs(tc.NUM_CLASS - square_arrgmnt) slct = np.argmin(remain_det) slct_ = np.mod(slct + 1, 2) rows_label = choices[slct] col_distribution = np.ones((rows_label, 1)) * rows_label col_distribution[rows_label // 2 - remain_det[slct] // 2:rows_label // 2 - remain_det[slct] // 2 + remain_det[slct]] = choices[slct_] nDet = int(np.amin(col_distribution)) NDet = int(np.amax(col_distribution))