Skip to main content

CocoRobo AI Training Tools

Project description

CocoRobo AI Training Tool

Requirements

Pacakages:

  • scikit-image==0.16.2
  • matplotlib>=3.3.0
  • numpy>=1.19.5

System Requirements:

  • Nvidia CUDA & cuDNN installed
  • Ubuntu 16+

Usage

After this tool is installed, follow the instruction below to create your own model:

from cocoroboai import init, tool, train
import os, time

configuration = {
    "RootPath": os.getcwd(),
    "ConfigurationPath": os.getcwd() + "/config",
    "DatasetPath": os.getcwd() + "/dataset",
    "DarknetPath": os.getcwd() + "/darknet-linux"
}

init = init(configuration)
tool, train = tool(), train()

# Resize a raw dataset to 448 * 448 px dimension
log = tool.resize_dataset(
    path = dataset_path
)
print(log)

# Process labeled dataset
project_name = project_name
labeled_dataset_path = labeled_dataset_path

log = tool.get_labeled_dataset_from_local(
    name = project_name, 
    path = labeled_dataset_path
)
print(log)

processed_dataset_name = log["Response"]["DatasetName"]
print(processed_dataset_name)

# Get dataset ready for training
log = train.prepare(
    name = processed_dataset_name
)
print(log)

# Start training
log = train.start(
    name = processed_dataset_name
)
print(log)

# Checkout training status
status = train.status(
    name = processed_dataset_name
)
print(status)

# Constantly checking training status until the avg loss is lower than 0.06
while True:
    status = train.status(
        name = processed_dataset_name
    )
    time.sleep(1)

    if len(status["Response"]["LatestEpochStatus"]) > 0:
        latest_avg_loss = status["Response"]["LatestEpochStatus"]
        print("Latest epoch info:\t", latest_avg_loss)
        print("Latest weights info:\t", status["Response"]["WeightsInfo"])

        if float(latest_avg_loss["AverageLoss"]) <= 0.06:
            log = train.stop(
                name = processed_dataset_name
            )
            print(log)
            break

# Test trained model with default model and images
log = train.test(
    name = processed_dataset_name
)
print(log)

# Get training statistics
log = train.get_statistics(
    name = processed_dataset_name
)
for weight in log["Response"]["ModelInfo"]["Weights"]["WeightsList"]:
    print(weight["Iteration"])
    if weight["Iteration"] == "last":
        model_name = weight["ModelName"]
print(model_name)

# Test trained model with specified model and images
log = train.test(
    name = processed_dataset_name,
    model_name = model_name,
    image_path = image_path
)
print(log)

# Export to kmodel file
log = train.export_kmodel(
    name = name,
    model_name = model_name
)
print(log)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

cocorobo_ai_tool-0.1.3-py3-none-any.whl (14.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page