import models from losses import CrossEntropyLabelSmooth, DeepSupervision from utils.iotools import save_checkpoint from utils.avgmeter import AverageMeter from utils.logger import Logger from utils.torchtools import set_bn_to_eval, count_num_param from eval_metrics import evaluate from optimizers import init_optim parser = argparse.ArgumentParser(description='Train image model with cross entropy loss') # Datasets parser.add_argument('--root', type=str, default='data', help="root path to data directory") parser.add_argument('-d', '--dataset', type=str, default='market1501', choices=data_manager.get_names()) parser.add_argument('-j', '--workers', default=4, type=int, help="number of data loading workers (default: 4)") parser.add_argument('--height', type=int, default=256, help="height of an image (default: 256)") parser.add_argument('--width', type=int, default=128, help="width of an image (default: 128)") parser.add_argument('--split-id', type=int, default=0, help="split index") parser.add_argument('--use-lmdb', action='store_true', help="whether to use lmdb dataset") # CUHK03-specific setting parser.add_argument('--cuhk03-labeled', action='store_true', help="whether to use labeled images, if false, detected images are used (default: False)") parser.add_argument('--cuhk03-classic-split', action='store_true', help="whether to use classic split by Li et al. CVPR'14 (default: False)")
from samplers import RandomIdentitySampler from optimizers import init_optim parser = argparse.ArgumentParser( description= 'Train image model with cross entropy loss and hard triplet loss') # Datasets parser.add_argument('--root', type=str, default='/data2', help="root path to data directory") parser.add_argument('-d', '--dataset', type=str, default='market1501', choices=data_manager.get_names()) parser.add_argument('-j', '--workers', default=4, type=int, help="number of data loading workers (default: 4)") parser.add_argument('--height', type=int, default=256, help="height of an image (default: 256)") parser.add_argument('--width', type=int, default=128, help="width of an image (default: 128)") parser.add_argument('--split-id', type=int, default=0, help="split index") # CUHK03-specific setting