Example #1
0
File: gui.py Project: jtn-b/Mind-ID
    def __init__(self):
        initialise.init()
        super(mind_id, self).__init__()
        self.dirname = os.path.dirname(__file__)
        filename = os.path.join(self.dirname, 'login_window.ui')
        # print (dirname)
        loadUi(filename, self)

        filename = os.path.join(self.dirname, 'background.png')
        self.label_2.setPixmap(QtGui.QPixmap(filename))

        #######################
        #### MY CODE STARTS HERE

        self.reset()

        self.login_b.clicked.connect(self.login_clicked)
        self.signup_b.clicked.connect(self.signup_clicked)
        self.verify.clicked.connect(self.verify_clicked)
        self.submit.clicked.connect(self.submit_clicked)
        self.browse.clicked.connect(self.browse_clicked)
        self.home_button.clicked.connect(self.home_clicked)
        self.verify_email.clicked.connect(self.verify_email_clicked)
        self.regex = '^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$'
        self.home_button_2.clicked.connect(self.home_clicked)

        self.signup_sig = Communicate()
        # self.signup_sig = pyqtSignal()
        self.signup_sig.sig.connect(self.signup_in_progress)

        self.login_sig = Communicate()
        # self.signup_sig = pyqtSignal()
        self.login_sig.sig.connect(self.login_in_progress)
Example #2
0
def main():
    initialise.init()
    # colorcube_analysis()
    # histogram_analysis()
    # entropy_cc_analysis()
    # colorfulness_analysis()
    # r_on_fair_distribution()
    # data_analysis()
    # confusion()
    # select_ft_data('densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22.hdf5', [], 0, do_plot_boxes=True)
    # bdd100k_analysis('densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22.hdf5', do_plot_boxes=True)
    # bdd100k_cc_analysis()

# main()
Example #3
0
    def __init__(self,
                 ndim=10,
                 nwalkers=200,
                 nsteps=100,
                 run_id="1808/test1",
                 obsname='1808_obs.txt',
                 burstname='1808_bursts.txt',
                 gtiname='1808_gti.txt',
                 theta=(0.44, 0.01, 0.18, 2.1, 3.5, 0.108, 0.90, 0.5, 1.4,
                        11.2),
                 numburstssim=3,
                 numburstsobs=4,
                 bc=2.21,
                 ref_ind=1,
                 gti_checking=0,
                 threads=4,
                 restart=False,
                 train=None):

        from initialise import init
        from run_model import runmodel
        # Set up initial conditions:

        self.ndim = ndim
        self.nwalkers = nwalkers  # nwalkers and nsteps are the number of walkers and number of steps for emcee to do
        self.nsteps = nsteps
        self.run_id = run_id  # Where you want output to be saved and under what name
        self.theta = theta  # Set starting value for each theta parameter, Recall odering, theta: X, Z, Q_b, f_a, f_E, r1, r2, r3
        self.threads = threads  # Number of threads for emcee to use (e.g. number of cores your computer has)
        self.numburstssim = numburstssim  # this needs to be an integer value of half the number of bursts you want to simulate. I.e. simulate this many from the reference burst in either direction. Don't forget to account for missed bursts!
        self.numburstsobs = numburstsobs  # number of observed bursts in your dataset
        self.ref_ind = ref_ind  # Define index of reference burst (should be middle of predicted burst train). This burst will not be simulated but will be used as a reference to predict the other bursts.
        self.gti_checking = gti_checking  #Option to turn on gti time checking (1 for on, 0 for off):
        self.obsname = obsname  #set location of your observation data files
        self.burstname = burstname  #set location of your burst data files
        self.gtiname = gtiname  #set location of your gti data files
        self.bc = bc  #bolometric correction to apply to your persistent flux (1.0 if they are already bolometric fluxes):
        self.restart = restart  #if your run crashed and you would like to restart from a previous run, with run_id above, set this to True
        if train is None:
            train = 1
            self.train = train  # 1 For whether you want to generate a burst train or 0 for work on non contigius bursts
        else:
            train = 0
            self.train = train
        self.x, self.y, self.yerr, self.tref, self.bstart, self.pflux, self.pfluxe, self.tobs, self.fluen, self.st, self.et = init(
            ndim, nwalkers, theta, run_id, threads, numburstssim, numburstsobs,
            ref_ind, gti_checking, obsname, burstname, gtiname, bc, restart,
            train)
        print(self.st, self.et)

        # # -------------------------------------------------------------------------#
        # # TEST THE MODEL WORKS
        # # -------------------------------------------------------------------------#
        print(
            "# -------------------------------------------------------------------------#"
        )
        print("Doing Initialisation..")

        print("Testing the model works..")

        test, valid = runmodel(self.theta,
                               self.y,
                               self.tref,
                               self.bstart,
                               self.pflux,
                               self.pfluxe,
                               self.tobs,
                               self.numburstssim,
                               self.numburstsobs,
                               self.ref_ind,
                               self.gti_checking,
                               self.train,
                               self.st,
                               self.et,
                               debug=False)  # set debug to True for testing
        print("result: ", test, valid)

        self.plot_model(test)
Example #4
0
# Options
UPLOAD_FOLDER = paths.upload_folder
ALLOWED_EXTENSIONS = {'mp3', 'wav'}
previous_upload_dir = None
previous_filenames = None
genre_data_stats = True

app = Flask(__name__, static_url_path='')
CORS(app)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.config['MAX_CONTENT_LENGTH'] = 128 * 1024 * 1024
app.secret_key = 'key'

# Load all data from disk
data = initialise.init()

# Calculate genre stats on load if option is enabled
if genre_data_stats:
    from collections import Counter
    gsl = multi_logging.setup_logger('genre_stats', 'logs/genre_stats.log')
    genre_stats = Counter([song.listed_genre for song in data['song_data']])
    for key, value in genre_stats.most_common():
        gsl.info(str(key) + " " + str(value))


# Utility function for formatting predicted genres
def make_string(list):
    return ", ".join(list)

Example #5
0
def main():
    initialise.init()
    # Tests
    # show_distribution()
    # retinanet_train()
    # retinanet_tiny_train()
    # retinanet_test()
    # analyse.entropy_cc_analysis()
    # analyse.histogram_analysis()
    # analyse.colorcube_analysis()
    # imagenet_test()
    # cifar_color_domains_test()
    # show_ids()
    # box_size()
    # test_do_boxes_cross()
    # check_obj_annotations()
    # test_extract_non_superposing_boxes()
    # classification_dataset()
    # cc_grant()
    # return

    history_files = [
        'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_ref_hist.pkl',
        'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_city_street_ft_hist.pkl',
        'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_daytime_ft_hist.pkl',
        'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_highway_ft_hist.pkl',
        'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_night_ft_hist.pkl',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_ft_hist.pkl',
    ]

    model_files = [
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_refep30_vl0.23.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_daytime_ftep20_vl0.27.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_night_ftep01_vl0.16.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_highway_ftep02_vl0.22.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_city_street_ftep30_vl0.26.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_ref2_ft_ep05_vl0.25.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_daytime2_ftep04_vl0.24.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_night2_ftep03_vl0.15.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_highway2_ftep02_vl0.21.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_city_street2_ftep04_vl0.21.hdf5',
        'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_ref3_ft_ep11_vl0.23.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_daytime3_ftep06_vl0.24.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_night3_ftep01_vl0.15.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_highway3_ftep02_vl0.21.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_city_street3_ftep14_vl0.25.hdf5',

        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_ref_ftep02_vl0.23.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_daytime_ftep03_vl0.25.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_night_ftep01_vl0.16.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_highway_ftep01_vl0.21.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_city_street_ftep04_vl0.23.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_ref2_ft_ep02_vl0.25.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_daytime2_ft_ep02_vl0.23.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_night2_ft_ep03_vl0.16.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_highway2_ft_ep01_vl0.20.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_city_street2_ft_ep01_vl0.21.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_ref3_ft_ep01_vl0.26.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_daytime3_ft_ep02_vl0.23.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_night3_ft_ep01_vl0.15.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_highway3_ft_ep01_vl0.20.hdf5',
        # 'mobilenet_bdd100k_cl0-500k_20ep_woda_ep15_vl0.24_city_street3_ft_ep02_vl0.21.hdf5',

        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_ref_ftep10_vl0.26.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_daytime_ftep07_vl0.25.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_night_ftep04_vl0.16.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_highway_ftep07_vl0.24.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_city_street_ftep05_vl0.23.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_ref2_ft_ep01_vl0.21.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_daytime2_ft_ep08_vl0.25.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_night2_ft_ep03_vl0.15.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_highway2_ft_ep04_vl0.21.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_city_street2_ft_ep01_vl0.21.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_city_street2_ft_ep02_vl0.22.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_ref3_ft_ep10_vl0.23.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_daytime3_ft_ep02_vl0.23.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_night3_ft_ep03_vl0.15.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_highway3_ft_ep02_vl0.24.hdf5',
        # 'mobilenetv2_bdd100k_cl0-500k_20ep_woda_ep17_vl0.22_city_street3_ft_ep02_vl0.22.hdf5',

        # 'nasnet_bdd100k_cl0-500k_20ep_woda_ep17_vl0.24.hdf5',
        # 'resnet50_bdd100k_cl0-500k_20ep_woda_ep13_vl0.27.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_ft_day_ep06_vl0.24.hdf5',
        # 'densenet121_bdd100k_cl0-500k_20ep_woda_ep20_vl0.22_refep30_vl0.23.hdf5',
    ]
    # plotting.imshow(cv2.imread('../../bdd100k/classification/images/val/bbadf190-864c9a43-9.jpg'))
    # return
    # for mf in model_files:
    #     analyse.bdd100k_analysis(mf, do_plot_boxes=True)
    # analyse.analyse_attributes(model_files)
    # analyse.bdd100k_compare(model_files[1], model_files[0], 'scene', 'score')
    # load_model_test(model_files)

    # bdd100k_sel_partition_test()
    # bdd100k_global_finetune_test()
    # bdd100k_local_finetune_test(model_files)

    # show_history_test(history_files, log_path)
    # show_history_test(tb_path + )
    # subset_selection_test()
    # adjectives_finding_test()
    # train_bdd100k_cl()

    plotting.color_3channels_hist('/Users/user/Desktop/IEEEAITEST/grant.jpg')