国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

機器人技能學習-構建自己的數(shù)據(jù)集并進行訓練

這篇具有很好參考價值的文章主要介紹了機器人技能學習-構建自己的數(shù)據(jù)集并進行訓練。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

概要

若想訓練自己的場景,數(shù)據(jù)集的重要性不做過多贅述,下面就基于 robomimicrobosuite 構建自己的數(shù)據(jù)集進行講解,同時,也會附上 trainrun 的流程,這樣,就形成了閉環(huán)。

自建數(shù)據(jù)集

采集數(shù)據(jù)

采集數(shù)據(jù)可使用腳本 collect_human_demonstrations.py 完成,在采集過程中,需要自己定義 env 的相關信息,在實際使用時,存在以下幾個問題:

  • 無法控制機器人精準的完成抓取工作
  • 機器人在某些姿態(tài)下,運動會出現(xiàn)漂移的情況

機器人技能學習-構建自己的數(shù)據(jù)集并進行訓練,機器人,學習

格式轉換

該功能腳本為 convert_robosuite.py,在進行執(zhí)行是:

$ python conversion/convert_robosuite.py --dataset /path/to/demo.hdf5

生成OBS用于訓練

python dataset_states_to_obs.py --dataset demo_myliftdraw.hdf5 --output AAA.hdf5

BUG記錄

Bug1

在進行 conver_to_robosuite時,也有個小bug,當數(shù)據(jù)集中 demo數(shù)量較少時,比如為1,那么 convert 就會失敗,這是因為在進行 split 時數(shù)據(jù)太少導致的,

"""
Helper script to convert a dataset collected using robosuite into an hdf5 compatible with
this repository. Takes a dataset path corresponding to the demo.hdf5 file containing the
demonstrations. It modifies the dataset in-place. By default, the script also creates a
90-10 train-validation split.

For more information on collecting datasets with robosuite, see the code link and documentation
link below.

Code: https://github.com/ARISE-Initiative/robosuite/blob/offline_study/robosuite/scripts/collect_human_demonstrations.py

Documentation: https://robosuite.ai/docs/algorithms/demonstrations.html

Example usage:

    python convert_robosuite.py --dataset /path/to/your/demo.hdf5
"""

import h5py
import json
import argparse

import robomimic.envs.env_base as EB
from robomimic.scripts.split_train_val import split_train_val_from_hdf5


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--dataset",
        type=str,
        help="path to input hdf5 dataset",
    )
    args = parser.parse_args()

    f = h5py.File(args.dataset, "a") # edit mode
    # import ipdb; ipdb.set_trace()
    # store env meta

    env_name = f["data"].attrs["env"]
    env_info = json.loads(f["data"].attrs["env_info"])
    env_meta = dict(
        type=EB.EnvType.ROBOSUITE_TYPE,
        env_name=env_name,
        env_version=f["data"].attrs["repository_version"],
        env_kwargs=env_info,
    )
    if "env_args" in f["data"].attrs:
        del f["data"].attrs["env_args"]
    f["data"].attrs["env_args"] = json.dumps(env_meta, indent=4)

    print("====== Stored env meta ======")
    print(f["data"].attrs["env_args"])

    # store metadata about number of samples
    total_samples = 0
    for ep in f["data"]:
        # ensure model-xml is in per-episode metadata
        assert "model_file" in f["data/{}".format(ep)].attrs

        # add "num_samples" into per-episode metadata
        if "num_samples" in f["data/{}".format(ep)].attrs:
            del f["data/{}".format(ep)].attrs["num_samples"]
        n_sample = f["data/{}/actions".format(ep)].shape[0]
        f["data/{}".format(ep)].attrs["num_samples"] = n_sample
        total_samples += n_sample

    # add total samples to global metadata
    if "total" in f["data"].attrs:
        del f["data"].attrs["total"]
    f["data"].attrs["total"] = total_samples

    f.close()

    # create 90-10 train-validation split in the dataset
    split_train_val_from_hdf5(hdf5_path=args.dataset, val_ratio=0.1)

最后一行,只需要將 val_ration = 1 就可以了。

Bug2

描述:同樣的操作過程,用自己新建的 env環(huán)境類生成數(shù)據(jù),在進行 obs 生成時報錯,但是用官方的 env 是沒有問題的
機器人技能學習-構建自己的數(shù)據(jù)集并進行訓練,機器人,學習
解決方法:不要試圖隨性構建自己的模型庫,因為這玩意是按照固定路徑搜索的,坑坑坑,忙了半天,發(fā)現(xiàn)是路徑的問題,里面有個 robosuite 的固定關鍵詞,這個會影響 to obs 的。
機器人技能學習-構建自己的數(shù)據(jù)集并進行訓練,機器人,學習

Train && Test

Train 需要調用的腳本是:

$ python robomimic/robomimic/scripts/train.py --config bc_rnn.json

Test調用的腳本為:

$ python robomimic/robomimic/scripts/un_trained_agent.py --agent /path/to/model.pth --n_rollouts 50 --horizon 400 --seed 0 --video_path /path/to/output.mp4 --camera_names agentview robot0_eye_in_hand 

在進行訓練時,需要對算法進行配置,即導入的 json 文件,以下是一個配置文件的案例,該文件來源于 mimicgen 生成的,其中,里面 有對于算法的部分參數(shù), 比如 "algo_name": "bc",如果功底不夠深厚的話,建議大家只改下數(shù)據(jù)集的 path 就可以了:

{
    "algo_name": "bc",
    "experiment": {
        "name": "source_draw_low_dim",
        "validate": false,
        "logging": {
            "terminal_output_to_txt": true,
            "log_tb": true,
            "log_wandb": false,
            "wandb_proj_name": "debug"
        },
        "save": {
            "enabled": true,
            "every_n_seconds": null,
            "every_n_epochs": 50,
            "epochs": [],
            "on_best_validation": false,
            "on_best_rollout_return": false,
            "on_best_rollout_success_rate": true
        },
        "epoch_every_n_steps": 100,
        "validation_epoch_every_n_steps": 10,
        "env": null,
        "additional_envs": null,
        "render": false,
        "render_video": true,
        "keep_all_videos": false,
        "video_skip": 5,
        "rollout": {
            "enabled": true,
            "n": 50,
            "horizon": 400,
            "rate": 50,
            "warmstart": 0,
            "terminate_on_success": true
        }
    },
    "train": {
        "data": "/home/idm/Documents/mimicgen/robosuite/robosuite/scripts/generate_dataset/tmp/draw_data/demo_obs.hdf5",
        "output_dir": "/home/idm/Documents/mimicgen/robosuite/robosuite/scripts/generate_dataset/tmp/draw_data/trained_models",
        "num_data_workers": 0,
        "hdf5_cache_mode": "all",
        "hdf5_use_swmr": true,
        "hdf5_load_next_obs": false,
        "hdf5_normalize_obs": false,
        "hdf5_filter_key": null,
        "hdf5_validation_filter_key": null,
        "seq_length": 10,
        "pad_seq_length": true,
        "frame_stack": 1,
        "pad_frame_stack": true,
        "dataset_keys": [
            "actions",
            "rewards",
            "dones"
        ],
        "goal_mode": null,
        "cuda": true,
        "batch_size": 100,
        "num_epochs": 2000,
        "seed": 1
    },
    "algo": {
        "optim_params": {
            "policy": {
                "optimizer_type": "adam",
                "learning_rate": {
                    "initial": 0.001,
                    "decay_factor": 0.1,
                    "epoch_schedule": [],
                    "scheduler_type": "multistep"
                },
                "regularization": {
                    "L2": 0.0
                }
            }
        },
        "loss": {
            "l2_weight": 1.0,
            "l1_weight": 0.0,
            "cos_weight": 0.0
        },
        "actor_layer_dims": [],
        "gaussian": {
            "enabled": false,
            "fixed_std": false,
            "init_std": 0.1,
            "min_std": 0.01,
            "std_activation": "softplus",
            "low_noise_eval": true
        },
        "gmm": {
            "enabled": true,
            "num_modes": 5,
            "min_std": 0.0001,
            "std_activation": "softplus",
            "low_noise_eval": true
        },
        "vae": {
            "enabled": false,
            "latent_dim": 14,
            "latent_clip": null,
            "kl_weight": 1.0,
            "decoder": {
                "is_conditioned": true,
                "reconstruction_sum_across_elements": false
            },
            "prior": {
                "learn": false,
                "is_conditioned": false,
                "use_gmm": false,
                "gmm_num_modes": 10,
                "gmm_learn_weights": false,
                "use_categorical": false,
                "categorical_dim": 10,
                "categorical_gumbel_softmax_hard": false,
                "categorical_init_temp": 1.0,
                "categorical_temp_anneal_step": 0.001,
                "categorical_min_temp": 0.3
            },
            "encoder_layer_dims": [
                300,
                400
            ],
            "decoder_layer_dims": [
                300,
                400
            ],
            "prior_layer_dims": [
                300,
                400
            ]
        },
        "rnn": {
            "enabled": true,
            "horizon": 10,
            "hidden_dim": 400,
            "rnn_type": "LSTM",
            "num_layers": 2,
            "open_loop": false,
            "kwargs": {
                "bidirectional": false
            }
        },
        "transformer": {
            "enabled": false,
            "context_length": 10,
            "embed_dim": 512,
            "num_layers": 6,
            "num_heads": 8,
            "emb_dropout": 0.1,
            "attn_dropout": 0.1,
            "block_output_dropout": 0.1,
            "sinusoidal_embedding": false,
            "activation": "gelu",
            "supervise_all_steps": false,
            "nn_parameter_for_timesteps": true
        }
    },
    "observation": {
        "modalities": {
            "obs": {
                "low_dim": [
                    "robot0_eef_pos",
                    "robot0_eef_quat",
                    "robot0_gripper_qpos",
                    "object"
                ],
                "rgb": [],
                "depth": [],
                "scan": []
            },
            "goal": {
                "low_dim": [],
                "rgb": [],
                "depth": [],
                "scan": []
            }
        },
        "encoder": {
            "low_dim": {
                "core_class": null,
                "core_kwargs": {},
                "obs_randomizer_class": null,
                "obs_randomizer_kwargs": {}
            },
            "rgb": {
                "core_class": "VisualCore",
                "core_kwargs": {},
                "obs_randomizer_class": null,
                "obs_randomizer_kwargs": {}
            },
            "depth": {
                "core_class": "VisualCore",
                "core_kwargs": {},
                "obs_randomizer_class": null,
                "obs_randomizer_kwargs": {}
            },
            "scan": {
                "core_class": "ScanCore",
                "core_kwargs": {},
                "obs_randomizer_class": null,
                "obs_randomizer_kwargs": {}
            }
        }
    },
    "meta": {
        "hp_base_config_file": null,
        "hp_keys": [],
        "hp_values": []
    }
}

部分訓練截圖如下,可以看出,因數(shù)據(jù)太少,導致模型不收斂:
機器人技能學習-構建自己的數(shù)據(jù)集并進行訓練,機器人,學習

參考資料

RoboMimic文章來源地址http://www.zghlxwxcb.cn/news/detail-794869.html

到了這里,關于機器人技能學習-構建自己的數(shù)據(jù)集并進行訓練的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。如若轉載,請注明出處: 如若內(nèi)容造成侵權/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領支付寶紅包贊助服務器費用

相關文章

  • 使用langchain與你自己的數(shù)據(jù)對話(五):聊天機器人

    使用langchain與你自己的數(shù)據(jù)對話(五):聊天機器人

    之前我已經(jīng)完成了使用langchain與你自己的數(shù)據(jù)對話的前四篇博客,還沒有閱讀這四篇博客的朋友可以先閱讀一下: 使用langchain與你自己的數(shù)據(jù)對話(一):文檔加載與切割 使用langchain與你自己的數(shù)據(jù)對話(二):向量存儲與嵌入 使用langchain與你自己的數(shù)據(jù)對話(三):檢索(Retrieva

    2024年02月13日
    瀏覽(24)
  • isaacgym(legged_gym)學習 (一)—— 添加自己的機器人模型并訓練

    提示:寫完文章后,目錄可以自動生成,如何生成可參考右邊的幫助文檔 例如:isaacgym系列學習記錄。 這里默認已經(jīng)安裝好isaacgym學習環(huán)境,并可以成功運行其中的案例 這里我以宇數(shù)科技的GO2機器人為例,去其官網(wǎng)下載GO2的urdf文件 下載好了urdf文件,將其中resources/robots/go2文

    2024年02月20日
    瀏覽(170)
  • 技能下載中:Sora視頻讓機器人秒學任何技藝!

    技能下載中:Sora視頻讓機器人秒學任何技藝!

    視頻:技能下載中:Sora視頻讓機器人秒學任何技藝! 引言 在機器人成為平凡工匠和前沿先驅的時代,我們正站在新黎明的邊緣。本文將探討斯坦福大學的通用操作接口(UMI)及其與OpenAI的Sora如何共同推進機器人技術,開創(chuàng)未來學習的新紀元。 正文 斯坦福的通用操作接口(

    2024年02月22日
    瀏覽(16)
  • 理解構建LLM驅動的聊天機器人時的向量數(shù)據(jù)庫檢索的局限性 - (第1/3部分)

    理解構建LLM驅動的聊天機器人時的向量數(shù)據(jù)庫檢索的局限性 - (第1/3部分)

    本博客是一系列文章中的第一篇,解釋了為什么使用大型語言模型( LLM )部署專用領域聊天機器人的主流管道成本太高且效率低下。在第一篇文章中,我們將討論為什么矢量數(shù)據(jù)庫盡管最近流行起來,但在實際生產(chǎn)管道中部署時從根本上受到限制。在下面的文章中,我們說

    2024年02月14日
    瀏覽(21)
  • 【機器人學習】MPU6050數(shù)據(jù)的換算

    【機器人學習】MPU6050數(shù)據(jù)的換算

    由于近期在搞IMU的姿態(tài)解算,需要用一個IMU傳感器去進行角度的獲取,因此采用了最實惠的MPU6050!通過IIC讀取MPU6050后的數(shù)據(jù)只是簡單的數(shù)值,并沒有物理意義,因此本文主要記錄下如何將MPU6050的數(shù)據(jù)換算成有意義的物理值。 要得到MPU6050的具體參數(shù),那必須是官方的datashe

    2024年02月14日
    瀏覽(18)
  • 如何防止機器人或者爬蟲訪問自己的網(wǎng)站

    在網(wǎng)站的robots.txt文件中設置禁止機器人訪問的頁面或目錄。 Robots.txt是一個文本文件,用于告訴搜索引擎哪些頁面或目錄不應該被訪問??梢酝ㄟ^在robots.txt文件中添加\\\"Disallow\\\"指令來告訴機器人禁止訪問某些頁面或目錄。例如: 上述例子中,我們禁止了所有機器人訪問/admin

    2024年02月12日
    瀏覽(26)
  • 手把手自己制作一個飛書機器人

    手把手自己制作一個飛書機器人

    飛書機器人 如果你想添加新的對話邏輯,你只需要在 ChatApi.py 中添加新的if條件判斷語句即可。如果你能開發(fā)出新功能,請在倉庫中提出Pull requests合并請求,我將感激不盡! 2023年9月1日更新 更新了對話機器人返回幫助界面功能,用戶發(fā)送“幫助”,返回機器人使用說明 20

    2024年02月03日
    瀏覽(26)
  • 自己制作智能語音機器人(基于jetson nano)

    自己制作智能語音機器人(基于jetson nano)

    如上圖,主要采用jetson上編寫python代碼實現(xiàn),支持離線語音喚醒、在線語音識別、大模型智能文檔、在線語音合成。 所需硬件如下: jetson nano:linux 科大訊飛麥克風硬件:AIUI R818麥克陣列開發(fā)套件+6麥陣列,支持離線語音喚醒 USB免驅聲卡+喇叭 所需軟件如下: 科大訊飛在線語

    2024年02月15日
    瀏覽(99)
  • GPT2訓練自己的對話問答機器人

    GPT2訓練自己的對話問答機器人

    這里我搭建了虛擬的3.6環(huán)境 基于GPT2的中文閑聊機器人,模型實現(xiàn)基于HuggingFace的transformers ,精讀GPT2-Chinese的論文和代碼,獲益匪淺。 data/train.txt:默認的原始訓練集文件,存放閑聊語料;data/train.pkl:對原始訓練語料進行tokenize之后的文件,存儲一個list對象,list的每條數(shù)據(jù)表示一個

    2024年02月12日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領取紅包,優(yōu)惠每天領

二維碼1

領取紅包

二維碼2

領紅包