/args_util.py (5f8c6f423f9c2c73691ba8fad003ac6631d08347) (6955 bytes) (mode 100644) (type blob)

"""
contain dummy args with config
helpfull for copy paste Kaggle
"""
import argparse
from hard_code_variable import HardCodeVariable

def make_args(gpu="0", task="task_one_"):
    """
    these arg does not have any required commandline arg (all with default value)
    :param train_json:
    :param test_json:
    :param pre:
    :param gpu:
    :param task:
    :return:
    """
    parser = argparse.ArgumentParser(description='PyTorch CSRNet')

    args = parser.parse_args()
    args.gpu = gpu
    args.task = task
    args.pre = None
    return args

class Meow():
    def __init__(self):
        pass


def make_meow_args(gpu="0", task="task_one_"):
    args = Meow()
    args.gpu = gpu
    args.task = task
    args.pre = None
    return args


def like_real_args_parse(data_input):
    args = Meow()
    args.input = data_input
    args.original_lr = 1e-7
    args.lr = 1e-7
    args.batch_size = 1
    args.momentum = 0.95
    args.decay = 5 * 1e-4
    args.start_epoch = 0
    args.epochs = 120
    args.steps = [-1, 1, 100, 150]
    args.scales = [1, 1, 1, 1]
    args.workers = 4
    args.print_freq = 30


def context_aware_network_args_parse():
    """
    this is not dummy
    if you are going to make all-in-one notebook, ignore this
    :return:
    """
    parser = argparse.ArgumentParser(description='CrowdCounting Context Aware Network')
    parser.add_argument("--task_id", action="store", default="dev")
    parser.add_argument('-a', action="store_true", default=False)

    parser.add_argument('--input', action="store",  type=str, default=HardCodeVariable().SHANGHAITECH_PATH_PART_A)
    parser.add_argument('--output', action="store", type=str, default="saved_model/context_aware_network")
    parser.add_argument('--datasetname', action="store", default="shanghaitech_keepfull")

    # args with default value
    parser.add_argument('--load_model', action="store", default="", type=str)
    parser.add_argument('--lr', action="store", default=1e-8, type=float)
    parser.add_argument('--momentum', action="store", default=0.9, type=float)
    parser.add_argument('--decay', action="store", default=5*1e-3, type=float)
    parser.add_argument('--epochs', action="store", default=1, type=int)
    parser.add_argument('--test', action="store_true", default=False)


    arg = parser.parse_args()
    return arg


def my_args_parse():
    parser = argparse.ArgumentParser(description='CrowdCounting Context Aware Network')
    parser.add_argument("--task_id", action="store", default="dev")
    parser.add_argument('--note', action="store", default="write anything")

    parser.add_argument('--input', action="store",  type=str, default=HardCodeVariable().SHANGHAITECH_PATH_PART_A)
    parser.add_argument('--datasetname', action="store", default="shanghaitech_keepfull")

    # args with default value
    parser.add_argument('--load_model', action="store", default="", type=str)
    parser.add_argument('--lr', action="store", default=1e-8, type=float)
    parser.add_argument('--momentum', action="store", default=0.9, type=float)
    parser.add_argument('--decay', action="store", default=5*1e-3, type=float)
    parser.add_argument('--epochs', action="store", default=1, type=int)
    parser.add_argument('--batch_size', action="store", default=1, type=int,
                        help="only set batch_size > 0 for dataset with image size equal")
    parser.add_argument('--test', action="store_true", default=False)
    arg = parser.parse_args()
    return arg


def meow_parse():
    parser = argparse.ArgumentParser(description='CrowdCounting Context Aware Network')
    parser.add_argument("--task_id", action="store", default="dev")
    parser.add_argument("--model", action="store", default="dev")
    parser.add_argument('--note', action="store", default="write anything")

    parser.add_argument('--input', action="store",  type=str, default=HardCodeVariable().SHANGHAITECH_PATH_PART_A)
    parser.add_argument('--datasetname', action="store", default="shanghaitech_keepfull")

    # args with default value
    parser.add_argument('--load_model', action="store", default="", type=str)
    parser.add_argument('--lr', action="store", default=1e-8, type=float)
    parser.add_argument('--momentum', action="store", default=0.9, type=float)
    parser.add_argument('--decay', action="store", default=5*1e-3, type=float)
    parser.add_argument('--epochs', action="store", default=1, type=int)
    parser.add_argument('--batch_size', action="store", default=1, type=int,
                        help="only set batch_size > 0 for dataset with image size equal")
    parser.add_argument('--test', action="store_true", default=False)
    arg = parser.parse_args()
    return arg

def sanity_check_dataloader_parse():
    parser = argparse.ArgumentParser(description='Dataloader')
    parser.add_argument('--input', action="store",  type=str, default=HardCodeVariable().SHANGHAITECH_PATH_PART_A)
    parser.add_argument('--datasetname', action="store", default="shanghaitech_keepfull")
    arg = parser.parse_args()
    return arg


def real_args_parse():
    """
    this is not dummy
    if you are going to make all-in-one notebook, ignore this
    :return:
    """
    parser = argparse.ArgumentParser(description='CrowdCounting')
    parser.add_argument("--task_id", action="store", default="dev")
    parser.add_argument('-a', action="store_true", default=False)

    parser.add_argument('--input', action="store",  type=str, default=HardCodeVariable().SHANGHAITECH_PATH_PART_A)
    parser.add_argument('--output', action="store", type=str, default="saved_model")
    parser.add_argument('--model', action="store", default="pacnn")

    # args with default value
    parser.add_argument('--load_model', action="store", default="", type=str)
    parser.add_argument('--lr', action="store", default=1e-8, type=float)
    parser.add_argument('--momentum', action="store", default=0.9, type=float)
    parser.add_argument('--decay', action="store", default=5*1e-3, type=float)
    parser.add_argument('--epochs', action="store", default=1, type=int)
    parser.add_argument('--test', action="store_true", default=False)

    # pacnn setting only
    parser.add_argument('--PACNN_PERSPECTIVE_AWARE_MODEL', action="store", default=0, type=int)
    parser.add_argument('--PACNN_MUTILPLE_SCALE_LOSS', action="store", default=1, type=int,
                        help="1: compare each of  density map/perspective map scale with gt for loss."
                             "0: only compare final density map and final density perspective map")

    # args.original_lr = 1e-7
    # args.lr = 1e-7
    # args.batch_size = 1
    # args.momentum = 0.95
    # args.decay = 5 * 1e-4
    # args.start_epoch = 0
    # args.epochs = 120
    # args.steps = [-1, 1, 100, 150]
    # args.scales = [1, 1, 1, 1]
    # args.workers = 4
    # args.seed = time.time()
    # args.print_freq = 30

    arg = parser.parse_args()
    return arg

Mode Type Size Ref File
100644 blob 61 169fe2b7d512a59cfedf86ddb7ed040173c7434d .gitignore
100644 blob 699 c3455dfa4e1ddcb2e6c28d284dcc3471623e796b README.md
100644 blob 6955 5f8c6f423f9c2c73691ba8fad003ac6631d08347 args_util.py
040000 tree - 5e9d7f0e1fd3a9e4d5a37f3d6de0c3ecd3125af8 backup_notebook
040000 tree - 55d1d196f5b6ed4bfc1e8a715df1cfff1dd18117 bug
100644 blob 1775 1165f1aba0814b448a3595a32bd74f1967509509 crowd_counting_error_metrics.py
100644 blob 21225 fbf8547f25e589d24bd38d401d426dd8ebb56220 data_flow.py
040000 tree - 17c9c74641b7acc37008a7f940a62323dd5b2b6b data_util
040000 tree - 2a46ff24b8b8997b4ca07c18e2326cb3c35dc5a0 dataset_script
040000 tree - 9862b9cbc6e7a1d43565f12d85d9b17d1bf1814e env_file
100644 blob 4460 9b254c348a3453f4df2c3ccbf21fb175a16852de eval_context_aware_network.py
100644 blob 428 35cc7bfe48a4ed8dc56635fd3a6763612d8af771 evaluator.py
100644 blob 5987 6e113ad7abec0f20ba45f851c87418d4a1ceadb7 experiment_meow_main.py
100644 blob 1916 1d228fa4fa2887927db069f0c93c61a920279d1f explore_model_summary.py
100644 blob 2718 b09b84e8b761137654ba6904669799c4866554b3 hard_code_variable.py
100644 blob 15300 cb90faba0bd4a45f2606a1e60975ed05bfacdb07 main_pacnn.py
100644 blob 2760 3c2d5ba1c81ef2770ad216c566e268f4ece17262 main_shanghaitech.py
100644 blob 2683 29189260c1a2c03c8e59cd0b4bd61df19d5ce098 main_ucfcc50.py
100644 blob 2039 e52f9798497dd23f9610b99ce00affcdede70082 model_util.py
040000 tree - 5e0aed07e1837613c2eb0a437bf71130943cb85b models
040000 tree - fda4709b3c737edcee433b11037542ea9fb85733 playground
040000 tree - 970ac54d8293aed6667e016f2245547f3a5449c3 pytorch_ssim
100644 blob 1297 4017dd69212681e01c4be222934bdbe1eda9e54c sanity_check_dataloader.py
100644 blob 3525 27067234ad3deddd743dcab0d7b3ba4812902656 train_attn_can_adcrowdnet.py
100644 blob 3488 e47bfc7e91c46ca3c61be0c5258302de4730b06d train_attn_can_adcrowdnet_freeze_vgg.py
100644 blob 5352 3ee3269d6fcc7408901af46bed52b1d86ee9818c train_attn_can_adcrowdnet_simple.py
100644 blob 5728 90b846b68f15bdc58e3fd60b41aa4b5d82864ec4 train_attn_can_adcrowdnet_simple_lrscheduler.py
100644 blob 5588 6ee730cd73a9b32b8b16a017c30f21e4399fc55a train_compact_cnn.py
100644 blob 5594 f03be4aeb9b1f134f0c105bb2305728091d92538 train_compact_cnn_lrscheduler.py
100644 blob 3525 eb52f7a4462687c9b2bf1c3a887014c4afefa26d train_context_aware_network.py
100644 blob 5514 07a23b00e2cac7fce0699c7c10f7a6349744a7e3 train_custom_compact_cnn.py
100644 blob 5594 07d6c9c056db36082545b5b60b1c00d9d9f6396d train_custom_compact_cnn_lrscheduler.py
100644 blob 5281 8a92eb87b54f71ad2a799a7e05020344a22e22d3 train_custom_compact_cnn_sgd.py
040000 tree - 4997d853462b5c1c8a0d40b850c2403ab1667946 train_script
100644 blob 5392 03c78fe177520b309ee21e5c2b7ca67598fad99a visualize_data_loader.py
100644 blob 1146 1b0f845587f0f37166d44fa0c74b51f89cf8b349 visualize_util.py
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/hahattpro/crowd_counting_framework

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/hahattpro/crowd_counting_framework

Clone this repository using git:
git clone git://git.rocketgit.com/user/hahattpro/crowd_counting_framework

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main