Skip to content

TTool‐ai Guide for user

Nazgul Zholmagambetova edited this page Jan 22, 2024 · 65 revisions

Overview Section

Welcome to TTool-ai! This guide will help you navigate through the FastAPI interface of TTool-ai, a powerful tool for video processing and machine learning model training. TTool-ai offers seven key basic functions to streamline your workflow.

Accessing TTool-ai

To begin using TTool-ai, access the FastAPI interface via the URL http://localhost:16666/docs. Once there, you will see a user-friendly interface listing the available functions.

image

TTool-ai Functionality Overview

TTool-ai is equipped with a range of functionalities crucial for video processing and machine learning model training:

  1. /upload_videos: This function enables users to upload video files into the dataset.

  2. /check_video_status: Users can check the status of their uploaded videos to ensure they have been successfully uploaded and are ready for further actions.

  3. /delete_video: This option allows users to remove videos from the dataset that are no longer needed or were uploaded by mistake.

  4. /get_classes_available: This feature retrieves a comprehensive list of classes available in the database. These classes are essential for tailoring custom machine learning models.

  5. /train_model: Users can train machine learning models using selected classes. This training is facilitated on the EPFL server, ensuring robust and efficient model development.

  6. /check_train_status/: This functionality provides users with the ability to monitor the progress of their model training, offering insights into the training process.

  7. /get_train_model: After the training is complete, users can retrieve their trained models along with the associated labels. These models are particularly useful for applications in Augmented Carpenrty.

Dataset Section

/upload_videos

Functionality: Upload your video files to the dataset.

How to Use:

Navigate to the /upload_videos endpoint on the TTool-ai interface.

Click Try it out on the upper left corner of the interface. This applies to the other endpoints as well.

Choose the video file you wish to upload.

Write the label for this particular video. Note: one label correspond only to one video!

Click Execute on the bottom.

image

Successful Response

After clicking the Execute button, if everything is in order, you will receive a system response similar to this:

image

Important Note: Please make sure to remember the video_id as it will be required to check the video processing status or to delete the video if needed.

The system will process and store the videos in the dataset. You can check the status of the upload by accessing the /check_video_status/{video_id} endpoint, replacing {video_id} with the actual ID of your video.

Other Responses

This output indicates that the video already exists in the database. In such a scenario, please upload a different video to proceed.

image

For any response other than the expected one, please retry the operation.

/check_video_status

Functionality: This endpoint allows you to verify the status of uploaded videos to ensure they have been successfully processed and uploaded to the system.

How to Use:

Navigate to the /check_video_status endpoint on the TTool-ai interface.

Click Try it out on the upper left corner of the interface.

Insert the video_id of the video you want to check.

imageedit_20_7529903441

Click the Execute button to initiate the status check.

imageedit_22_3159033990

Successful Response

When everything is functioning correctly, the system will provide a response for the video that appears as follows:

image

Other Responses

If the specified video is not found in the system, or if you have entered an incorrect video_id, you will receive a response that appears as follows:

image

Videos can vary in length, and the processing time may differ accordingly. If a video is particularly long or requires more time to process, the system will display a processing or pending status. In such cases, please wait patiently until the video is successfully uploaded and processed by the system. This ensures that the video is accurately analyzed and ready for further actions.

image image

Occasionally, video uploads may encounter issues, resulting in a failed upload. In such instances, you will receive the following response:

image

For any response other than the expected one, please retry the operation.

/delete_video

Functionality: Delete a video file from the dataset.

How to Use:

Navigate to the /delete_video endpoint on the TTool-ai interface.

image

Click Try it out on the upper left corner of the interface.

Insert the video_id of the video you wish to delete.

imageedit_26_5336354336

Click the Execute button to initiate the deletion process.

image

Successful Response

If the deletion is successful, you will receive a return message that specified video is removed from the dataset:

image

Other Responses

If the specified video is not found in the system, or if you have entered an incorrect video_id, you will receive a response that appears as follows:

image

When attempting to delete a video that is still undergoing processing, you will receive the following system response:

image

This response indicates that the video is currently in the processing phase, and you can proceed with the deletion only when the processing status is marked as "completed." Please wait until the processing is finished before attempting to delete the video.

For any response other than the expected one, please retry the operation.

Training Section

/get_classes_available

image

To initiate the training of a Machine Learning Classifier/Model, it's essential to determine which classes are available for selection. This endpoint serves the purpose of retrieving a list of available classes, allowing you to choose the necessary ones for your training process.

Functionality: Retrieve a list of available classes from the dataset for machine learning model training.

How to Use:

Navigate to the /get_classes_available endpoint on the TTool-ai interface.

image

Click Try it out on the upper left corner of the interface.

Simply click the Execute button to retrieve the list of available classes. No additional inputs are required.

image

Successful Response

The system will respond with a list of available classes that you can choose from for your machine learning model training.

image

If the system outputs this: [], it indicates that there are currently no classes available in the database. In this case, you will need to upload videos and create classes to populate the database with the necessary information.

Other Responses

If you see a response like this:

image

It means that a database is currently unavailable, please, try again later.

For any response other than the expected one, please retry the operation.

/train_model

Functionality: Train a machine learning model using selected classes from the dataset.

How to Use:

Navigate to the /train_model endpoint on the TTool-ai interface.

image

Click Try it out on the upper left corner of the interface.

Specify the classes you want to use for training. You can list the classes like this:

"classes": [
  "auger_drill_bit_20_235",
  "auger_drill_bit_20_400",
  "auger_drill_bit_20_450",
  "auger_drill_bit_34_235",
  "brad_point_drill_bit_20_150",
  "chain_saw_blade_f_250",
  "chain_swordsaw_blade_200",
  "circular_saw_blade_makita_190",
  "saber_saw_blade_makita",
  "self_feeding_bit_40_90",
  "self_feeding_bit_50_90",
  "spade_drill_bit_25_150",
  "twist_drill_bit_32_165"
]

Specify the number of epochs for training. The number of epochs should be non-negative and non-zero. You can start with around 10-15 epochs and adjust as needed. An example: "epochs": 5

Specify the batch_size for training. The batch size should be non-zero and non-negative, typically ranging from 2-20. Example: "batch_size": 10

Overall the input should be like this:

{
  "classes": [
  "auger_drill_bit_20_235",
  "auger_drill_bit_20_400",
  "auger_drill_bit_20_450",
  "auger_drill_bit_34_235",
  "brad_point_drill_bit_20_150",
  "chain_saw_blade_f_250",
  "chain_swordsaw_blade_200",
  "circular_saw_blade_makita_190",
  "saber_saw_blade_makita",
  "self_feeding_bit_40_90",
  "self_feeding_bit_50_90",
  "spade_drill_bit_25_150",
  "twist_drill_bit_32_165"
],
  "epochs": 5,
  "batch_size": 10
}

Click the Execute button to initiate the training process.

image

The system will use the specified classes, epochs, and batch size to train a machine learning model.

Successful Response

If the training starts successfully, you will receive a system response like this:

image

Note: Save the user_id provided in the response. You will need it to check the status of the training and retrieve the trained model.

Other Responses

If you haven't provided any data, as shown below:

image

You will receive a response like this. Please ensure that you fill in all the necessary information before proceeding with training.

image

Additionally, if you do not specify the number of epochs or a batch number, you will encounter errors like the ones below:

image image

For any response other than the expected one, please retry the operation.

/check_train_status

Functionality: Check the status of the machine learning model training process.

How to Use:

Navigate to the /check_train_status endpoint on the TTool-ai interface.

image

Click Try it out on the upper left corner of the interface.

Specify the user_id associated with the training process that you want to check.

imageedit_7_5261365215

Click the Execute button to initiate the status check.

image

The system will provide a response indicating the current status of the machine learning model training.

Successful Response

image

If train is completed successfully, you are ready to get your machine learning model!

Other Responses

While your training is still in progress, you may receive a response like this:

image

If your training is in the queue, waiting for its turn to be processed, you will receive a response like this:

image

Sometimes, training may fail, and you may encounter an error like this:

image

If you see this, please, try again.

For any response other than the expected one, please retry the operation too.

/get_train_model

When you receive a "completed" training status, you can proceed to retrieve the trained machine learning model and its associated labels for use in Augmented Carpentry (AC).

Functionality: Retrieve the trained machine learning model and associated labels.

How to Use:

Navigate to the /get_train_model endpoint on the TTool-ai interface.

image

Click Try it out on the upper left corner of the interface.

Specify the user_id associated with the training process.

imageedit_10_8168080107

Click the Execute button to initiate the retrieval process.

image

Successful Response

Once the retrieval process is complete, you will receive a link to download a zip file:

imageedit_31_9071605114

Please click on this link to download the trained_model_and_labels.zip to your computer.

Zip file contains efficientnet.pt and labels.txt file:

image

These files can be included into Augmented carpentry or any other application.

Other Responses

If the training isn't finished yet, you won't be able to get the model. You'll see a message like this:

image

It might also happen that the model and labels are not found in the database:

image

If you encounter this, we encourage you to start the training again.

For any response other than the expected one, please retry the operation too.

Machine Learning Model and Labels used in Augmented Carpentry (AC)

Please, refer to a documentation on TTool which is the part of Augmented Carpentry (AC)