-
创建项目配置文件:
- 创建一个名为
potatso_config.py的新文件。 - 含有以下参数:
project_name: 'your_project_name' project_path: 'path/to/your/project' version: '.1.'
- 创建一个名为
potatso_data_config.csv的文件,包含训练、验证、测试数据,每行数据格式为:image_path, text_path, class - 创建一个名为
potatso_model_config.json的文件,包含:{ "model_path": "path/to/your/model", "headers": ["batch_size", "iterations", "learning_rate", "weight_decay", "regularization"], "hyperparams": { "batch_size": 32, "iterations": 1, "learning_rate": 0.1, "weight_decay": 0.1, "regularization": 0.1 } }
- 创建一个名为
-
配置 potatso_inference 和 potatso_inference_multi 端点:
- 在 potatso_config.py 中,添加:
potatso_inference: { "url": "https://your potatso API endpoint", "headers": { "Content-Type": "application/json" }, "response": { "json": { "format": "json" } }, "params": { "model_path": "path/to/your/model" } } - 同样配置 potatso_inference_multi。
- 在 potatso_config.py 中,添加:
-
配置 potatso_inference 和 potatso_inference_multi 端点:
- 在 potatso_config.py 中,添加:
potatso_inference_multi: { "url": "https://your potatso API endpoint", "headers": { "Content-Type": "application/json" }, "response": { "json": { "format": "json" } }, "params": { "potatso_inference": { "url": "https://your potatso API endpoint", "headers": { "Content-Type": "application/json" }, "response": { "json": { "format": "json" } }, "params": { "model_path": "path/to/your/model" } } } }
- 在 potatso_config.py 中,添加:
-
配置 potatso_data_config:
- 在 potatso_config.py 中,添加:
potatso_data_config: { "training": { "data": { "file": "potatso_data_config.csv", "split_ratio": [".9", ".1"] } }, "validation": { "data": { "file": "potatso_data_config.csv", "split_ratio": [".95", ".5"] } }, "testing": { "data": { "file": "potatso_data_config.csv", "split_ratio": [".98", ".2"] } } }
- 在 potatso_config.py 中,添加:
-
配置 potatso_model_config:
- 在 potatso_config.py 中,添加:
potatso_model_config: { "training": { "data": { "file": "potatso_data_config.csv", "batch_size": 32, "data_loader": { "class": "TextSegmentLoader", "path": "path/to/images", "text_path": "path/to/texts", "batch_size": 32, "shuffle": True } }, "data_loader": { "iterator": "DataLoader", "shuffle": True, "batch_size": 32 }, "device": "cpu", "iterations": 1, "lr": 0.1, "weight_decay": 0.1, "reg": 0.1 } }
- 在 potatso_config.py 中,添加:
-
配置 potatso_inference 和 potatso_inference_multi 的响应结构:
- potatso_inference 的响应结构应包含图像和文本处理后的结果。
- potatso_inference_multi 的响应结构应包含更详细的处理结果。
-
配置 potatso_inference 和 potatso_inference_multi 的请求头:
- potatso_inference 的请求头应包含:
{ "Content-Type": "application/json" } - potatso_inference_multi 的请求头应包含:
{ "Content-Type": "application/json" }
- potatso_inference 的请求头应包含:
-
配置 potatso_inference 和 potatso_inference_multi 的超参数:
- potatso_inference 的超参数应与 potatso_model_config 相匹配。
- potatso_inference_multi 的超参数应与 potatso_inference 和 potatso_model_config 相匹配。
-
配置 potatso_inference 和 potatso_inference_multi 的返回结构:
- potatso_inference 的返回结构应包含处理后的图像和文本。
- potatso_inference_multi 的返回结构应包含处理后的图像、文本和类别。
-
配置 potatso_inference 和 potatso_inference_multi 的日志配置:
- potatso_inference的日志文件路径应与 potatso_inference_multi的日志文件路径一致。
- 日志的收集频率应设置为日志日的1次。
-
配置 potatso_inference 和 potatso_inference_multi 的训练配置:
如果需要训练模型,配置 potatso_model_config 以指定训练数据路径、数据加载器、数据加载频率和训练参数。
-
配置 potatso_inference 和 potatso_inference_multi 的测试配置:
如果需要测试模型,配置 potatso_test_config,指定测试数据路径、测试参数和测试响应结构。
-
配置 potatso_inference 和 potatso_inference_multi 的使用配置:
- 在 Potatso API 的文档中查看如何调用 potatso_inference 和 potatso_inference_multi。
- 示例代码:在 Python 中调用 potatso_inference 或 potatso_inference_multi 函数,传递必要的参数。
-
注意事项:
- 确保所有配置文件的路径正确,避免路径错误。
- 确保 Potatso API 的文档和文档结构与配置文件中的设置一致。
- 如果出现数据文件格式错误,检查数据文件的路径是否正确。
通过以上步骤,可以成功配置 Potatso 来处理图像和文本数据,并实现模型的训练和推理。









