Skip to content

Core Java library for accessing the UFDL backend, managing the communication.

License

Notifications You must be signed in to change notification settings

waikato-ufdl/ufdl-java-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ufdl-java-client

Core Java library for accessing the UFDL backend, managing the communication and executing actions.

Modules

The following modules are available

  • ufdl4j-core - core API calls (users, teams, projects, datasets)
  • ufdl4j-image - image API calls (image classification, image segmentaiton, object detection)
  • ufdl4j-speech - speech API calls

API

ufdl4j-core

  • com.github.waikatoufdl.ufdl4j.action.Users - managing users
  • com.github.waikatoufdl.ufdl4j.action.Teams - managing teams
  • com.github.waikatoufdl.ufdl4j.action.Projects - managing projects
  • com.github.waikatoufdl.ufdl4j.action.Datasets - managing datasets
  • com.github.waikatoufdl.ufdl4j.action.Licenses - managing licenses (must be admin to add licenses)
  • com.github.waikatoufdl.ufdl4j.action.Log - managing log entries
  • com.github.waikatoufdl.ufdl4j.action.Domains - managing domains
  • com.github.waikatoufdl.ufdl4j.action.CudaVersions - managing CUDA versions
  • com.github.waikatoufdl.ufdl4j.action.Frameworks - managing frameworks
  • com.github.waikatoufdl.ufdl4j.action.HardwareGenerations - managing hardware generations
  • com.github.waikatoufdl.ufdl4j.action.DockerImages - managing docker images
  • com.github.waikatoufdl.ufdl4j.action.PretrainedModels - managing pretrained models
  • com.github.waikatoufdl.ufdl4j.action.Nodes - managing nodes
  • com.github.waikatoufdl.ufdl4j.action.JobTypes - managing job types
  • com.github.waikatoufdl.ufdl4j.action.JobTemplates - managing job templates
  • com.github.waikatoufdl.ufdl4j.action.Jobs - managing jobs
  • com.github.waikatoufdl.ufdl4j.action.Generic - for generic API calls

ufdl4j-image

  • com.github.waikatoufdl.ufdl4j.action.ImageClassificationDatasets - managing image classification datasets
  • com.github.waikatoufdl.ufdl4j.action.ImageSegmentationDatasets - managing image segmentation datasets
  • com.github.waikatoufdl.ufdl4j.action.ObjectDetectionDatasets - managing object classifications datasets

ufdl4j-speech

  • com.github.waikatoufdl.ufdl4j.action.SpeechDatasets - managing speech datasets

Example code

Instantiating the client for communicating with the backend:

import com.github.waikatoufdl.ufdl4j.Client;
import com.github.waikatoufdl.ufdl4j.action.Users.User;

public static class Test {
  public static void main(String[] args) throws Exception {
    // instantiate client (automatically refreshes/obtains API tokens when executing actions)
    Client client = new Client("http://127.0.0.1:8000", "USER", "PW");
  }
}

The core actions that can be accessed via the client:

  • client.users() - user management
  • client.teams() - team management
  • client.projects() - project management
  • client.datasets() - (core) dataset management
  • client.licenses() - licenses management
  • client.log() - log management
  • client.domains() - domain management
  • client.cuda() - CUDA version management
  • client.frameworks() - framework management
  • client.hardware() - hardware generations management
  • client.docker() - docker image management
  • client.pretrainedModels() - pretrained model management
  • client.nodes() - node management
  • client.jobTypes() - job type management
  • client.jobTemplates() - job template management
  • client.jobs() - job management
import com.github.waikatoufdl.ufdl4j.Client;
import com.github.waikatoufdl.ufdl4j.action.Users.User;
import com.github.waikatoufdl.ufdl4j.action.Teams.Team;
import com.github.waikatoufdl.ufdl4j.action.Projects.Project;
import com.github.waikatoufdl.ufdl4j.action.Datasets.Dataset;
import com.github.waikatoufdl.ufdl4j.action.Licenses.License;
import com.github.waikatoufdl.ufdl4j.action.Log.LogEntry;

public static class Test {
  public static void main(String[] args) throws Exception {
    Client client = new Client("http://127.0.0.1:8000", "USER", "PW");
    // output all users
    System.out.println("\nUsers:");
    for (User user: client.users().list()) {
      System.out.println(user);
    }
    // output all teams
    System.out.println("\nTeams:");
    for (Team team: client.teams().list()) {
      System.out.println(team);
    }
    // output all projects
    System.out.println("\nProjects:");
    for (Project project: client.projects().list()) {
      System.out.println(project);
    }
    // output all datasets
    System.out.println("\nDatasets:");
    for (Dataset dataset: client.datasets().list()) {
      System.out.println(dataset);
    }
    // output all licenses
    System.out.println("\nLicenses:");
    for (License license: client.licenses().list()) {
      System.out.println(license);
    }
    // output all log entries
    System.out.println("\nLog:");
    for (LogEntry entry: client.log().list()) {
      System.out.println(entry);
    }
  }
}

Additional actions can be accessed as follows (get cached):

import com.github.waikatoufdl.ufdl4j.Client;
import com.github.waikatoufdl.ufdl4j.action.ObjectDetectionDatasets;
import com.github.waikatoufdl.ufdl4j.action.ObjectDetectionDatasets.Annotations;
import java.util.Map;

public static class Test {
  public static void main(String[] args) throws Exception {
    Client client = new Client("http://127.0.0.1:8000", "USER", "PW");
    Dataset dataset = client.dataets().load(11);  // load dataset with primary key (PK) 11
    ObjectDetectionDatasets objdet = client.action(ObjectDetectionDatasets.class);
    Map<String,Annotations> all = objdet.getAnntations(dataset);  // load annotations for all images in dataset
  }
}

Example classes

ufdl4j-core

ufdl4j-image

ufdl4j-speech

About

Core Java library for accessing the UFDL backend, managing the communication.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages