Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
|
|
2 years ago | |
|---|---|---|
| .. | ||
| RFNet | 2 years ago | |
| robo_detection | 2 years ago | |
| yaml | 2 years ago | |
| README.md | 2 years ago | |
This example introduces how to use Sedna lifelong learning to implement the lifelong learning delivery task of the robot in the campus.
This demo mainly shows:
Follow the Sedna installation document to install Sedna.
Step1: download data.txt
and upload it to a specfied s3 directory. In this example, the directory is s3://kubeedge/sedna-robo/sedna_data.
Step2: download and decompress sedna_data.zip,
then upload the training images in it to the s3 directory where data.txt is stored.
This example uses these images:
These images are generated by the script build_images.sh.
Before this, user must provide an s3 directory for storage which is denoted as "s3_prefix" in this example, by setting environment variable s3_prefix.
s3_prefix=$s3_prefix
cloud_image=swr.cn-south-1.myhuaweicloud.com/sedna/sedna-robo:v0.1.1
edge_image=swr.cn-south-1.myhuaweicloud.com/sedna/sedna-robo-infer:v0.1.1
data_url=$s3_prefix/sedna_data/data.txt
DATA_NODE=sedna-mini-control-plane
TRAIN_NODE=sedna-mini-control-plane
EVAL_NODE=sedna-mini-control-plane
INFER_NODE=sedna-mini-control-plane
OUTPUT=$s3_prefix/lifelonglearningjob/output
job_name=robo-demo
Before this, users must generate the S3_ENDPOINT, ACCESS_KEY_ID and SECRET_ACCESS_KEY of their own s3 accounts and set environment
variables S3_ENDPOINT, ACCESS_KEY_ID and SECRET_ACCESS_KEY.
action=${1:-create}
kubectl $action -f - <<EOF
apiVersion: v1
stringData:
ACCESS_KEY_ID: $ACCESS_KEY_ID
SECRET_ACCESS_KEY: $SECRET_ACCESS_KEY
kind: Secret
metadata:
name: my
annotations:
s3-endpoint: $S3_ENDPOINT
type: Opaque
EOF
kubectl $action -f - <<EOF
apiVersion: sedna.io/v1alpha1
kind: Dataset
metadata:
name: lifelong-dataset-robo
spec:
url: "$data_url"
format: "txt"
nodeName: "$DATA_NODE"
credentialName: my
EOF
action=${1:-create}
kubectl $action -f - <<EOF
apiVersion: sedna.io/v1alpha1
kind: LifelongLearningJob
metadata:
name: $job_name
spec:
dataset:
name: "lifelong-dataset-robo"
trainProb: 0.8
trainSpec:
template:
spec:
nodeName: $TRAIN_NODE
dnsPolicy: ClusterFirstWithHostNet
containers:
- image: $cloud_image
name: train-worker
imagePullPolicy: IfNotPresent
args: ["sedna_train.py"]
env:
- name: "train_ratio"
value: "0.9"
- name: "BACKEND_TYPE"
value: "PYTORCH"
resources:
limits:
cpu: 6
memory: 6Gi
requests:
cpu: 3
memory: 3Gi
volumeMounts:
- mountPath: /dev/shm
name: cache-volume
volumes:
- emptyDir:
medium: Memory
sizeLimit: 128Mi
name: cache-volume
trigger:
checkPeriodSeconds: 30
timer:
start: 00:00
end: 24:00
condition:
operator: ">"
threshold: 100
metric: num_of_samples
evalSpec:
template:
spec:
nodeName: $EVAL_NODE
dnsPolicy: ClusterFirstWithHostNet
containers:
- image: $cloud_image
name: eval-worker
imagePullPolicy: IfNotPresent
args: ["sedna_evaluate.py"]
env:
- name: "operator"
value: "<"
- name: "model_threshold" # Threshold for filtering deploy models
value: "0"
- name: "BACKEND_TYPE"
value: "PYTORCH"
resources:
limits:
cpu: 6
memory: 6Gi
requests:
cpu: 3
memory: 3Gi
deploySpec:
template:
spec:
nodeName: $INFER_NODE
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
containers:
- image: $edge_image
name: infer-worker
imagePullPolicy: IfNotPresent
env:
- name: "BIG_MODEL_IP"
value: "http://94.74.91.114"
- name: "BIG_MODEL_PORT"
value: "30001"
- name: "RUN_FILE"
value: "integration_main.py"
resources: # user defined resources
limits:
cpu: 6
memory: 6Gi
requests:
cpu: 3
memory: 3Gi
credentialName: my
outputDir: $OUTPUT/$job_name
EOF
kubectl get lifelonglearningjob
No Description
Go Python Shell Text Markdown other