Exemplo n.º 1
0
    print("Trainable params: {0:,}".format(trainable_params))
    print("Non-trainable params: {0:,}".format(total_params -
                                               trainable_params))
    print(
        "---------------------------------------------------------------------------------------------------------------------------"
    )
    print("Input size (MB): %0.2f" % total_input_size)
    print("Forward/backward pass size (MB): %0.2f" % total_output_size)
    print("Params size (MB): %0.2f" % total_params_size)
    print("Estimated Total Size (MB): %0.2f" % total_size)
    print(
        "---------------------------------------------------------------------------------------------------------------------------"
    )
    # return summary


##############################################################################################################
if __name__ == '__main__':

    os.environ["CUDA_VISIBLE_DEVICES"] = "2"

    model = resnet50(
    )  #Total params: 23,272,266 #Total FLOPS: 62,751,882 #Accuracy: 85.61_98.95
    #model = torch.load("model_training").cpu()
    model = torch.load("model_training_final").cpu()
    #model = model.module
    print("model:", model)

    #summary(model, (1, 28, 28), device="cpu")
    #summary(model, (3, 32, 32), device="cpu")
    summary(model, (3, 224, 224), device="cpu")
Exemplo n.º 2
0
        type=str,
        default=
        '/data1/Datasets/ImageNet/ILSVRC2012/ILSVRC2012_img_val_subfolders/',
        help='test dataset path')
    parser.add_argument("--parallel", type=int, default=1)
    parser.set_defaults(autoML=True)
    parser.set_defaults(train=False)
    args = parser.parse_args()

    return args


##############################################################################################################
if __name__ == '__main__':
    os.environ["CUDA_VISIBLE_DEVICES"] = "0,1,2,3"

    args = get_args()
    print("args:", args)

    model = resnet50(pretrained=False).cuda()
    torch.save(model, "model")
    print("model_training:", model)

    if args.parallel == 1:
        model = torch.nn.DataParallel(model).cuda()

    fine_tuner = FineTuner_CNN(args.train_path, args.test_path, model)
    fine_tuner.test()

    if args.autoML:
        fine_tuner.autoML()