CLI

Command-Line Interface (CLI) Overview for Project Configuration and Management

The CLI, accessed via the alias kcli, is designed to simplify the process of managing projects by offering configurable options for handling input materials, configuring project settings, and more. Below is a detailed guide on how to configure, upload materials, and manage your projects using the CLI.

Usage

To use the kcli CLI, various command-line arguments are available for configuring and managing your projects. Below is an overview of each argument and its functionality:

Command-Line Arguments

  1. --configs

    • Description: Configures the project settings. This must be used as a "standalone" argument to initialize the configuration.

  2. --input

    • Description: Specifies the path to the root folder that contains the project materials (images, frames, or video files).

  3. --prjType

    • Description: Defines the type of project you are creating. Options include:

      • image: For projects consisting of image files.

      • frames: For projects where videos are split into frames (each frame is an image).

      • video: For projects based on video files.

  4. --take_classes_from

    • Description: Specifies the project from which to clone classes. You provide the project name from which to take classes to use in the new project.

  5. --dataset_name

    • Description: Defines the name of the project or dataset you are creating.

  6. --delete_dataset

    • Description: The name of the dataset or project you wish to delete. This must be used as a "standalone" argument.

  7. --slice_mode

    • Description: Determines how the video frames are sliced.

    • Choices:

      • 1: Each file is framed once.

      • 2: Frame videos by a specific number of files (e.g., each 3 or 5 frames).

      • 3: Upload after the entire video is framed.

  8. --batch

    • Description: Defines the batch size for processing videos. Only integer values are accepted.

  9. --output_dir

    • Description: Specifies the output directory where sliced video files will be saved.

    • Important: The output directory must not overlap with the input path to avoid conflicts.

  10. --reconfigure

    • Description: Allows for reconfiguring project settings. This must be used as a "standalone" argument to modify configuration settings after initial setup.

Configuring the CLI

To configure the kcli tool, you will need to set various parameters that allow it to interact with your storage service (AWS or Google Cloud). You can initialize the configuration with the following command:

kcli --configs

During the configuration process, you will need to provide the following credentials and details:

  • AWS Configuration:

    • aws_access_key_id: AWS access key.

    • aws_secret_access_key: AWS secret access key.

    • bucket_name: The name of the S3 bucket.

    • description: (Optional) A description of the configuration.

    • storage_type: Set to aws for Amazon Web Services.

    • value: The storage path (e.g., s3/keylabs/).

  • Google Cloud Platform Configuration:

    • gcp_credential_path: Absolute path to your Google Cloud credentials file.

    • description: (Optional) A description of the configuration.

    • storage_type: Set to gcp for Google Cloud Platform.

    • value: The storage path (e.g., gs/keylabs/).


Reconfiguring the CLI

If you need to modify any configuration settings after the initial setup, use the following command:

kcli --reconfigure

If you have more than one storage prefix, you will be given the option to modify any of the existing prefixes.


Uploading Materials

The kcli CLI allows for uploading different types of materials, such as images, frames, and videos. Below are the commands for each type:

Uploading Images

To upload a collection of images, use the following command:

kcli --input C:\Users\DOM\Desktop\images --prjType image --dataset_name slicer

Uploading Frames

For uploading frames from a video, the following command can be used:

kcli --input C:\Users\DOM\Desktop\frames --prjType frames --dataset_name slicer

Uploading Videos

Uploading videos can be done in three different modes using the --slice_mode argument:

  1. Upload each file once framed:

    kcli --input C:\...\videos --prjType video --dataset_name slicer --slice_mode 1
  2. Upload by a specific number of framed files (e.g., each 3 or 5 frames):

    kcli --input C:\...\videos --prjType video --dataset_name slicer --slice_mode 2 --batch 2
  3. Upload after complete framing (i.e., upload once everything is framed):

    kcli --input C:\...\videos --prjType video --dataset_name slicer --slice_mode 3

Specifying Output Directory

You can specify an output directory for sliced video frames using the --output_dir argument. Make sure that the output directory path does not overlap with the input path. If not specified, a default output folder named cut will be created within the input path:

kcli --input C:\...\videos --prjType video --dataset_name slicer --output_dir C:\...\output_folder

Deleting a Project

To delete a project, you can use the following command:

kcli --delete_dataset slicer

This command will remove the specified project and all associated files from the system.

Last updated