{"id":21809434,"url":"https://github.com/akira4o4/xtrainer","last_synced_at":"2026-02-04T11:36:02.675Z","repository":{"id":247695199,"uuid":"826232728","full_name":"akira4O4/xTrainer","owner":"akira4O4","description":"PyTorch CV Trainer ","archived":false,"fork":false,"pushed_at":"2024-11-08T10:00:01.000Z","size":478,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"v3.0","last_synced_at":"2025-07-08T23:07:22.525Z","etag":null,"topics":["classification","computer-vision","framework","inference","linux","macos","mlflow","multitask","python","pytorch","segmentation","trainer","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akira4O4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-09T10:10:29.000Z","updated_at":"2024-10-22T09:09:06.000Z","dependencies_parsed_at":"2024-08-25T20:33:02.165Z","dependency_job_id":"e8665009-e91e-40a1-88dd-923d07f897f4","html_url":"https://github.com/akira4O4/xTrainer","commit_stats":null,"previous_names":["akira4o4/trainer-x","akira4o4/xtrainer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akira4O4/xTrainer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akira4O4%2FxTrainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akira4O4%2FxTrainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akira4O4%2FxTrainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akira4O4%2FxTrainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akira4O4","download_url":"https://codeload.github.com/akira4O4/xTrainer/tar.gz/refs/heads/v3.0","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akira4O4%2FxTrainer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29082929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T03:31:03.593Z","status":"ssl_error","status_checked_at":"2026-02-04T03:29:50.742Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","computer-vision","framework","inference","linux","macos","mlflow","multitask","python","pytorch","segmentation","trainer","windows"],"created_at":"2024-11-27T13:21:36.055Z","updated_at":"2026-02-04T11:36:02.658Z","avatar_url":"https://github.com/akira4O4.png","language":"Python","readme":"# \u003cdiv align=\"center\"\u003exTrainer\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003eVersion: 1.0.0-dev\u003c/div\u003e\n\u003cdiv align=\"center\"\u003eAuthor: Li Linfeng\u003c/div\u003e\n\n**\u003cdiv align=\"center\"\u003eLanguage: [English](README_EN.md)\u003c/div\u003e**\n\n---\n\n## 简介\n这是一个基于PyTorch的**分类**，**分割**，**多任务**的训练和推理框架，支持PyTorch原生模型和自定义模型，设计多种优化方案，模块化的设计了整个训练推理框架\n\n---\n\n## 特点\n- 支持`Linux`，`Windows`，`Macos`\n- 支持`分类`任务，`分割`任务，`多任务`\n- 支持`训练`和`推理`\n- 支持训练数据`预加载`\n- 支持`自定义模型`\n- 支持`MLflow`参数跟踪\n- 支持模块化添加Loss\n- 分类任务中数据`平衡采样`\n- 可视化`混淆矩阵`\n- 自动平衡多任务训练中数据量\n\n---\n\n## 安装\n```bash\ncd \u003cyour_workspace\u003e\ngit clone https://github.com/akira4O4/xTrainer.git\ncd xTrainer\npip install -r requirements.txt\n```\n---\n\n## 配置文件\n### 默认配置文件路径\n`xTrainer/configs/default.yaml`\n### 配置参数解析\n\n| 参数名字                    | 默认值         | 数据类型        | 描述                                                                                             |\n|-------------------------|-------------|-------------|------------------------------------------------------------------------------------------------|\n| `mode`                  | `train`     | `str`       | 运行模式\u003cbr/\u003e训练：`train`\u003cbr/\u003e测试：`test`                                                              |\n| `task`                  |             | `str`       | 任务类型\u003cbr/\u003e分类：classification\u003cbr/\u003e分割：segmentation\u003cbr/\u003e多任务：multitask                               |\n| `project`               |             | `str`       | 项目路径                                                                                           |\n| `experiment`            | `exp`       | `str`       | 每次实验名称                                                                                         |\n| `seed`                  | `0`         | `int`       | 随机种子                                                                                           |\n| `topk`                  | `[1,2]`     | `List[int]` | 分类topk范围                                                                                       |\n| `device`                | `0`         | `int`       | 模型运行设备                                                                                         |\n| `epochs `               | `100`       | `int`       | 最大轮训次数                                                                                         |\n| `workers`               | ` 0`        | `int`       | dataloader多进程数                                                                                 |\n| `not_val`               | `False`     | `bool`      | 是否进行验证，True：只训练不验证                                                                             |\n| `model`                 |             | `str`       | 模型名称                                                                                           |\n| `pretrained`            | ` True`     | `bool`      | 是否加载预训练模型，模型来自Pytorch Hub                                                                      |\n| `weight`                |             | `str`       | 预训练模型路径，来自本地模型                                                                                 |\n| `wh`                    | `[256,256]` | `List[int]` | 输入图像宽高                                                                                         |\n| `amp`                   | `True`      | `bool`      | 是否使用自动混合精度进行训练                                                                                 |\n| `cache`                 | `False`     | `bool`      | 是否使用数据预加载\u003cbr/\u003e开启后程序会提前**全部**加载所有数据                                                             |\n| `deterministic`         | `True`      | `bool`      | 用于启用确定性模式                                                                                      |\n| `save_period`           | `5`         | `int`       | 每训练x次就进行一次模型保存                                                                                 |\n| `classification.batch`  |             | `int`       | 分类任务的batch数                                                                                    |\n| `classifiction.classes` |             | `int`       | 分类任务的类别数                                                                                       |\n| `classification.train ` |             | `str`       | 分类任务的训练数据路径                                                                                    |\n| `classification.val`    |             | `str`       | 分类任务的验证数据路径                                                                                    |\n| `segmentation.batch`    |             | `int`       | 分割任务的batch数                                                                                    |\n| `segmentation.classes`  |             | `int`       | 分割任务的类别数（**分割类别数需要包含背景**）                                                                      |\n| `segmentation.train `   |             | `str`       | 分割任务的训练数据路径                                                                                    |\n| `segmentation.val  `    |             | `str`       | 分割任务的验证数据路径                                                                                    |\n| `optimizer`             | `auto`      | `str`       | 优化器名称\u003cbr/\u003eauto=\"AdamW\"\u003cbr/\u003e支持优化器=[\"Adam\", \"Adamax\", \"AdamW\", \"NAdam\", \"RAdam\"，\"RMSProp\"，\"SGD\"] |\n| `cos_lr `               | `False`     | `bool`      | 是否使用余弦退火学习率                                                                                    |\n| `lr0`                   | `0.001`     | `float`     | 初始学习率                                                                                          |\n| `lrf`                   | `0.01`      | `float`     | 最低学习率下降比例，最低学习率=`lr0*lrf  `                                                                    |\n| `momentum`              | `0.937`     | `float`     | 优化器冲量                                                                                          |\n| `alpha`                 | `auto`      | `List[int]` | Focal Loss参数                                                                                   |\n| `gamma`                 | `2.0`       | `float`     | Focal Loss参数                                                                                   |\n| `smooth`                | `1.0`       | `float`     | 分割loss中的稳定参数\u003cbr/\u003e极小目标：1e-6\u003cbr/\u003e正常目标：1.0                                                        |\n| `loss_sum_weights`      | `[1,1]`     | `List[int]` | 多任务中，分类loss于分割loss加权比例                                                                         |\n| `seg_loss_sum_weights`  | `[1,1,1]`   | `List[int]` | 多个分割loss中的加权比例                                                                                 |\n| `source`                |             | `str`       | 测试数据路径                                                                                         |\n| `test_weight`           |             | `str`       | 测试权重路径                                                                                         |\n| `cls_thr`               |             | `List[int]` | 分类任务阈值                                                                                         |\n| `seg_thr`               |             | `List[int]` | 分割任务阈值（**不需要包含背景**）                                                                            |\n| `mlflow_url`            | `localhost` | `str`       | mlflow URI                                                                                     |\n| `mlflow_port`           | `5000  `    | `int`       | mlflow端口                                                                                       |\n\n---\n\n## 如何使用自定义模型\n\n---\n\n## 训练数据格式\n\n### 分类任务\n\n### 分割任务\n\n### 多任务\n\n---\n\n## 训练\n\n\n\n---\n\n## 预测\n\n---\n\n## 导出ONNX、TorchScript\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakira4o4%2Fxtrainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakira4o4%2Fxtrainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakira4o4%2Fxtrainer/lists"}