Example #1
0
int main(int argc, char *argv[])
{
    if ((argc < 5) || (argc > 7)) {
        printf("Usage: janus_enroll sdk_path data_path metadata_file gallery_file [[algorithm] verbose]\n");
        return 1;
    }

    const char *ext1 = get_ext(argv[3]);
    const char *ext2 = get_ext(argv[4]);

    if (strcmp(ext1, "csv") != 0) {
    	printf("metadata_file must be \".csv\" format.\n");
    	return 1;
    }

    if (strcmp(ext2, "gal") != 0) {
    	printf("gallery_file must be \".gal\" format. \n");
    	return 1;
    }

    JANUS_ASSERT(janus_initialize(argv[1], argc >= 6 ? argv[5] : ""))
    JANUS_ASSERT(janus_create_gallery(argv[2], argv[3], argv[4], argc >= 7 ? atoi(argv[6]) : 0))
    JANUS_ASSERT(janus_finalize())

    janus_print_metrics(janus_get_metrics());
    return EXIT_SUCCESS;
}
Example #2
0
int main(int argc, char *argv[])
{
    int requiredArgs = 6;

    if ((argc < requiredArgs) || (argc > 9)) {
        printUsage();
        return 1;
    }

    const char *ext1 = get_ext(argv[4]);
    const char *ext2 = get_ext(argv[5]);
    if (strcmp(ext1, "csv") != 0) {
        printf("metadata_file must be \".csv\" format.\n");
        return 1;
    } else if (strcmp(ext2, "gal") != 0) {
        printf("gallery_file must be \".gal\" format. \n");
        return 1;
    }

    char *algorithm = NULL;
    int verbose = 0;

    for (int i=0; i<argc-requiredArgs; i++)
        if (strcmp(argv[requiredArgs+i],"-algorithm") == 0)
            algorithm = argv[requiredArgs+(++i)];
        else if (strcmp(argv[requiredArgs+i],"-verbose") == 0)
            verbose = 1;
        else {
            fprintf(stderr, "Unrecognized flag: %s\n", argv[requiredArgs+i]);
            return 1;
        }

    JANUS_ASSERT(janus_initialize(argv[1], argv[2], algorithm))

    janus_gallery gallery;
    JANUS_ASSERT(janus_allocate_gallery(&gallery))

    JANUS_ASSERT(janus_create_gallery(argv[3], argv[4], gallery, verbose))

    janus_metrics metrics = janus_get_metrics();
    size_t size = metrics.janus_initialize_template_speed.count;
    janus_flat_gallery flat_gallery = new janus_data[size*janus_max_template_size()];
    size_t bytes;
    JANUS_ASSERT(janus_flatten_gallery(gallery, flat_gallery, &bytes))
    std::ofstream file;
    file.open(argv[5], std::ios::out | std::ios::binary);
    file.write((char*)flat_gallery, bytes);
    file.close();
    JANUS_ASSERT(janus_finalize())

    janus_print_metrics(metrics);
    return EXIT_SUCCESS;
}
int main(int argc, char *argv[])
{
    if ((argc < 8) || (argc > 9)) {
        printf("Usage: janus_evaluate sdk_path target_gallery query_gallery target_metadata query_metadata simmat mask [algorithm]\n");
        return 1;
    }
    const char *ext1 = get_ext(argv[2]);
    const char *ext2 = get_ext(argv[3]);
    const char *ext3 = get_ext(argv[4]);
    const char *ext4 = get_ext(argv[5]);
    const char *ext5 = get_ext(argv[6]);
    const char *ext6 = get_ext(argv[7]);

    if (strcmp(ext1, "gal") != 0 || strcmp(ext2, "gal") != 0) {
    	printf("Gallery files must be \".gal\" format\n");
    	return 1;
    }

    if (strcmp(ext3, "csv") != 0 || strcmp(ext4, "csv") != 0) {
    	printf("Metadata files must be \".csv\" format\n");
    	return 1;
    }

    if (strcmp(ext5, "mtx") != 0) {
    	printf("Score matrix files must be \".mtx\" format\n");
    	return 1;
    }

    if (strcmp(ext6, "mask") != 0) {
    	printf("Mask matrix files must be \".mask\" format\n");
    	return 1;
    }

    JANUS_ASSERT(janus_initialize(argv[1], argc >= 9 ? argv[8] : ""))
    JANUS_ASSERT(janus_evaluate(argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]))
    JANUS_ASSERT(janus_finalize())

    janus_print_metrics(janus_get_metrics());
    return EXIT_SUCCESS;
}