• [问题求助] 苏美尔Summer楔形文字识别,有兴趣或有技术的大神们,集合!
    1、我已经通过特征字的对比,分析出5300年前-3600年前的苏美尔楔形文字,就是汉字甲骨文的前身。2、我已经通过文字对比,证明苏美尔Summer文明就是我大夏文明。3、我已经证明,希腊字母的本质是汉字。4、我已经论证了西方宗教信仰的上帝GOD,就是三皇五帝之黄帝;廣从广黄声。我现在希望有小伙伴们发挥专业技术,把全部的苏美尔楔形文字识读出来。(已人工识读出200来字)
  • [应用开发] mdc610 编译问题,求解决
    mdc610 上是否支持 Ascend sample 代码中samples/cplusplus/common/acllite目录下的 ACLLite库的编译。如果支持该怎么修改sample中对应的,1、INSTALL_DIR 2、THIRDPART_PATH 两个变量,看了下自带MakeFile中设置的路径在我当前mdc目录下找不到对应的,理论上肯定能支持acllite这个库编译的,请问我该如何操作!!!!!谢谢。。。。。。。。
  • [部署上线] 有没有本地验证模型部署文件可行性的方法
    云端部署本地模型需要提供customize_service.py config.json 和模型文件,有没有能够离线验证这套文件能否正确部署模型并预测的工具呢每次上传再部署文件感觉好麻烦我主要是在调试customize_service.py文件
  • [部署上线] 模型部署的前后处理文件该怎么写
    目标:上传本地模型,通过桶创建AI应用并部署在线服务,并成功实现在线手势图片预测背景介绍:利用ultralytics库的yolov8n.pt模型训练了一个手势识别的模型,由于云端环境不兼容,ultralytics的YOLO库无法正常使用,所以我把模型转化为了.pth格式的pytorch模型问题描述:在执行在线服务的预测阶段,模型无法正常预测,我猜测问题出现在customize_service.py的_postprocess方法不正确最近一次测试的报错日志:start. . .2024-12-02 15:17:05 CST [MainThread ] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/app.py[line:111] - INFO: Namespace(model_name='serve', model_path='/home/ma-user/infer/model/1/best.pth', pt_server_name='127.0.0.1', service_file='/home/ma-user/infer/model/1/customize_service.py') []2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/model_service.py[line:63] - INFO: preprocess time: 67.35610961914062ms [4743ed1de3ca493b82adaede25f6bd63]2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/model_service.py[line:63] - INFO: preprocess time: 67.35610961914062ms [4743ed1de3ca493b82adaede25f6bd63]2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/model_service.py[line:69] - INFO: infer time: 143.97621154785156ms [4743ed1de3ca493b82adaede25f6bd63]2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/model_service.py[line:69] - INFO: infer time: 143.97621154785156ms [4743ed1de3ca493b82adaede25f6bd63]2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/app.py[line:86] - ERROR: Algorithm crashed! [4743ed1de3ca493b82adaede25f6bd63]2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/app.py[line:86] - ERROR: Algorithm crashed! [4743ed1de3ca493b82adaede25f6bd63]2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/app.py[line:87] - ERROR: Traceback (most recent call last):File "/home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/app.py", line 83, in predictres = model_service.inference(rec_dict)File "/home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/model_service.py", line 70, in inferencedata = self._postprocess(data)File "/home/ma-user/infer/model/1/customize_service.py", line 70, in _postprocesstar = np.array(data[0])KeyError: 0[4743ed1de3ca493b82adaede25f6bd63]2024-12-02 15:17:54 CST [ThreadPoolEx] - /home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/app.py[line:87] - ERROR: Traceback (most recent call last):File "/home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/app.py", line 83, in predictres = model_service.inference(rec_dict)File "/home/ma-user/anaconda3/envs/PyTorch-1.8/lib/python3.7/site-packages/model_service/model_service.py", line 70, in inferencedata = self._postprocess(data)File "/home/ma-user/infer/model/1/customize_service.py", line 70, in _postprocesstar = np.array(data[0])KeyError: 0[4743ed1de3ca493b82adaede25f6bd63]我在本地写了一个测试import osimport randomimport torchfrom torchvision import transformsimport osimport numpy as npfrom PIL import Imagedef preprocess(data):preprocessed_data = {}for k, v in data.items():for file_name, file_content in v.items():# 使用PIL读取图像image_tar = Image.open(file_content).convert('RGB')# 定义预处理变换preprocess = transforms.Compose([transforms.Resize((512, 512)),transforms.ToTensor(),])# 应用预处理变换image_tar = preprocess(image_tar)# 添加batch维度image_tar = image_tar.unsqueeze(0)# 将处理后的图像数据存储到preprocessed_data中preprocessed_data[k] = image_tarreturn preprocessed_datadef postprocess(data):tar = np.array(data[0][0]) # 获取15 * 5376的数据cfd_board = 0.5 # 置信度阈值boxes, class_probs = tar[:4, :], tar[4:, :] # 前4个值为边界框坐标,后11个值为类别概率# 初始化输出列表box_tar = []class_tar = []# 遍历每个边界框for i in range(boxes.shape[1]):box = boxes[:, i]class_prob = class_probs[:, i]# 计算最大类别概率及其索引max_class_prob = np.max(class_prob)max_class_idx = np.argmax(class_prob)# 如果最大类别概率大于置信度阈值,则保留该边界框if max_class_prob > cfd_board:box_tar.append(box)class_tar.append(max_class_idx)output = [box_tar, class_tar]return outputif __name__ == '__main__':# 加载模型model_path = 'resnet/model/best.pth'model = torch.load(model_path)model.eval() # 设置模型为评估模式# 设置测试路径tar_path = 'test'tars = os.listdir(tar_path)# 随机选择一个测试图像tar = random.choice(tars)test_tar = tar# 预处理preprocessed_data = preprocess({'data': {test_tar: os.path.join(tar_path, test_tar)}})model_output = model(list(preprocessed_data.values())[0])# 后处理final_output = postprocess(model_output)这样是能正确读取预测数据的,但是云端部署的脚本我不太明白应该怎么写,目前在预测阶段会报错config.json{"model_algorithm": "image_classification","model_type": "PyTorch","runtime": "pytorch_1.8.0-cuda_10.2-py_3.7-ubuntu_18.04-x86_64","apis":[{"url": "/","method": "post","request":{"Content-type": "multipart/form-data","data":{"type": "object","properties":{"images":{"type": "file"}}}},"response":{"Content-type": "applicaton/json","data":{"type": "object","properties": {"detection_classes":{"type": "array","items":[{"type": "string"}]},"detection_boxes":{"type": "array","items":[{"type": "array","minItems": 4,"maxItems": 4,"items":[{"type": "number"}]}]},"detection_scores":{"type": "array","items":[{"type": "number"}]}}}}}],"dependencies":[{"installer": "pip","packages":[{"package_name": "ultralytics"}]}]}customize_service.py(主要问题都在这个文件的_postprocess方法)import torchfrom torchvision import transformsfrom model_service.pytorch_model_service import PTServingBaseServiceimport loggingimport osimport jsonimport numpy as npfrom PIL import Imageimport threadinglogging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')logger = logging.getLogger(__name__)def ppc(data):tar = np.array(data[0]) # 获取15 * 5376的数据cfd_board = 0.5 # 置信度阈值boxes, class_probs = tar[:4, :], tar[4:, :] # 前4个值为边界框坐标,后11个值为类别概率# 初始化输出列表box_tar = []class_tar = []class_prob_tar = []# 遍历每个边界框for i in range(boxes.shape[1]):box = boxes[:, i]class_prob = class_probs[:, i]# 计算最大类别概率及其索引max_class_prob = np.max(class_prob)max_class_idx = np.argmax(class_prob)# 如果最大类别概率大于置信度阈值,则保留该边界框if max_class_prob > cfd_board:box_tar.append(box)class_tar.append(max_class_idx)class_prob_tar.append(max_class_prob)output = [box_tar, class_tar, class_prob_tar]return outputclass CustomInferenceService(PTServingBaseService):def __init__(self, model_name, model_path):super(CustomInferenceService, self).__init__(model_name, model_path)self.model_name = model_nameself.model_path = model_pathself.model_inputs = {}self.model_outputs = {}self.classes = ['unknown', 'dislike', 'like', 'OK', 'fist','victory', 'heart', 'palm', 'stop', '666', 'rock']# 初始化 label 属性self.label = self.classes# 非阻塞方式加载PyTorch模型,防止阻塞超时thread = threading.Thread(target=self.load_pytorch_model)thread.start()def load_pytorch_model(self):try:# 加载PyTorch模型self.model = torch.load(self.model_path)self.model.eval() # 设置模型为评估模式logger.info("PyTorch model loaded successfully")except Exception as e:logger.error(f"Failed to load PyTorch model: {e}")def _preprocess(self, data):logger.debug(f"Data received in postprocess: {data}")preprocessed_data = {}try:for k, v in data.items():for file_name, file_content in v.items():# 使用PIL读取图像image_tar = Image.open(file_content).convert('RGB')# 定义预处理变换preprocess = transforms.Compose([transforms.Resize((512, 512)),transforms.ToTensor(),transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),])# 应用预处理变换image_tar = preprocess(image_tar)# 添加batch维度image_tar = image_tar.unsqueeze(0)# 将处理后的图像数据存储到preprocessed_data中preprocessed_data[k] = image_tarexcept Exception as e:logger.error(f"Preprocessing failed: {e}")raisereturn preprocessed_data# 将推理的结果进行后处理,得到预期的输出格式,该结果就是最终的返回值def _postprocess(self, data):results = {}for k, v in data.items():ppc_data = ppc(v)detection_classes = ppc_data[1]detection_boxes = ppc_data[0]detection_scores = ppc_data[2]results[k] = {"detection_classes": detection_classes,"detection_boxes": detection_boxes,"detection_scores": detection_scores}return results# 对于输入数据进行前向推理,得到推理结果def _inference(self, data):result = {}for k, v in data.items():result[k] = self.model(v)return result数据描述:output = model(input)output[0]的形状:1 * 15 * 5376  (5376=64^2 + 32^2 + 16^2)output[1][0]的形状:1*75*64*64output[1][1]的形状:1*75*32*32output[1][2]的形状:1*75*16*16
  • [问题求助] 第九期 最后提交问题
    第九期 最后提交错了  能重新提交一次吗
  • [问题求助] python3 -c "import torch;import torch_npu; a = torch.randn(3, 4).npu(); print(a + a);" 报错
    安装了910b的cann,RC2,安装了torch2.3.1和torch_npu2.3.1,python3.10.15,一直报错python3 -c "import torch;import torch_npu; a = torch.randn(3, 4).npu(); print(a + a);" 报错  [W compiler_depend.ts:615] Warning: expandable_segments currently defaults to false. You can enable this feature by `export PYTORCH_NPU_ALLOC_CONF = expandable_segments:True`. (function operator()) EH9999: Inner Error! EH9999  [Init][Env]init env failed![FUNC:ReportInnerError][FILE:log_inner.cpp][LINE:145]         TraceBack (most recent call last):         build op model failed, result = 500001[FUNC:ReportInnerError][FILE:log_inner.cpp][LINE:145]  Traceback (most recent call last):   File "<string>", line 1, in <module>   File "/root/.local/lib/python3.10/site-packages/torch/_tensor.py", line 464, in __repr__     return torch._tensor_str._str(self, tensor_contents=tensor_contents)   File "/root/.local/lib/python3.10/site-packages/torch/_tensor_str.py", line 697, in _str     return _str_intern(self, tensor_contents=tensor_contents)   File "/root/.local/lib/python3.10/site-packages/torch/_tensor_str.py", line 617, in _str_intern     tensor_str = _tensor_str(self, indent)   File "/root/.local/lib/python3.10/site-packages/torch/_tensor_str.py", line 349, in _tensor_str     formatter = _Formatter(get_summarized_data(self) if summarize else self)   File "/root/.local/lib/python3.10/site-packages/torch/_tensor_str.py", line 138, in __init__     tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0) RuntimeError: The Inner error is reported as above. The process exits for this inner error, and the current working operator name is IsFinite. Since the operator is called asynchronously, the stacktrace may be inaccurate. If you want to get the accurate stacktrace, pleace set the environment variable ASCEND_LAUNCH_BLOCKING=1. [ERROR] 2024-11-21-10:49:01 (PID:20848, Device:0, RankID:0) ERR00100 PTA call acl api failed 
  • [问题求助] 第九期问题求助:给的测试集图片可以直接标注后拿来训练吗
    第九期问题求助:给的4000多张测试集图片可以直接标注后拿来训练吗
  • [其他] 关于手机拍照的一些有趣想法
    最近忽然有个有趣的想法,关于手机应用的。 概况:目前拍照是手机售卖时竞争点,但往往比拼的是用了什么先进的硬件。而消费者的痛点是拿着好手机拍不出好照片。 思考:如果能用一个AI辅助工具帮助消费者拍出好照片,会很有市场。 目前竞品:目前的照相辅助app都是通过AI调节色度等来优化图片 具体想法:将网友旅游打卡照片在地图上实时定位(照片天气、拍摄时间同拍摄者相同才会在地图显示),APP使用者只用选择喜欢的照片,导航到该位置,然后按APP上自己喜欢的照片角度拍照,直接解决不会构图,不会控制光线的问题,再借鉴整合现有成熟的AI调色,就可以拍出完美照片。 优点:帮助消费者在所有景区经典打卡地拍出超出自身审美的优秀照片;如果能变成手机自身功能之一,可以降低手机对拍照硬件的比拼需求,降低成本。困难:需要抓取网络拍摄的优秀照片并将照片与地图结合,需要控制相机部件的调焦(在征求拍照人意见后)
  • [训练管理] yolov5训练报错,如何更换环境中的numpy版本
    我在进行yolov5模型训练时,得到了报错,TypeError: 'numpy.float64' object cannot be interpreted as an integer,根据CSDN上的回答,我尝试修改numpy版本,但依旧不成功。我查看日志发现,似乎知识成功下载了numpy:Looking in indexes: http://pip.modelarts.private.com:8888/repository/pypi/simple Collecting numpy==1.16.4   Downloading http://pip.modelarts.private.com:8888/repository/pypi/packages/numpy/1.16.4/numpy-1.16.4.zip (5.1 MB) Requirement already satisfied: pillow in /home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages (from -r /home/ma-user/modelarts/user-job-dir/YOLOv5/requirements.txt (line 2)) (9.5.0),但却并没能成功安装,依旧是原来的版本Requirement already satisfied: numpy>=1.16.4 in /home/ma-user/anaconda3/envs/MindSpore/lib/python3.7/site-packages (from moxing-framework==2.1.6.879ab2f4) (1.21.2)请问我要如何才能正确修改numpy版本为我指定的版本呢?或者有没有别的办法来解决这个报错呢?
  • [训练管理] Modelarts上训练yolov5模型报错
    我是在gitee上下载的2.1版的官方mindspore yolov5模型代码,模型代码链接是cid:link_0,修改了配置文件来适应我的数据集,即配置文件有关数据集的部分被改动了(只改动了数据路径的部分,没有被删掉的项)(我采用了自己的数据集,标注格式和coco2017相同,数据集和和模型都存储在obs上),其他都没有变化,但在训练的时候出现这个错误:TypeError: modelarts_pre_process() missing 1 required positional argument: 'args'请问有人知道问题在哪里吗?我应该怎么进行修改呢?
  • [数据管理] 数据集
    求求大佬们教教我,PCB的数据集咋弄阿。感觉我的模型没问题的。
  • [问题求助] CANN ImportError: libhccl.so: cannot open shared object file
    python=3.8, torch=2.1.0 torch-npu=2.1.0,CANN_toolkit=7.0.1.1,版本应该都是对应的python是miniconda下的环境,有source set_env.sh ,可以find到libhccl.so这个文件,但是export LD_LIBRARY_PATH没有用报错信息:Traceback (most recent call last):   File "/home/x/miniconda3/envs/pytorch38/lib/python3.8/site-packages/torch_npu/__init__.py", line 14, in <module>     import torch_npu.npu   File "/home/x/miniconda3/envs/pytorch38/lib/python3.8/site-packages/torch_npu/npu/__init__.py", line 110, in <module>     from .utils import (synchronize, device_count, can_device_access_peer, set_device, current_device, get_device_name,   File "/home/x/miniconda3/envs/pytorch38/lib/python3.8/site-packages/torch_npu/npu/utils.py", line 11, in <module>     import torch_npu._CImportError: libhccl.so: cannot open shared object file: No such file or directory. Please check that the cann package is installed. Please run 'source set_env.sh' in the CANN installation path.
  • [训练管理] 训练作业的过程中怎么显示没有medpy模块报错,应该怎么解决?
    训练作业的过程中怎么显示没有这个模块报错,应该怎么解决?
  • [其他问题] loss曲线怎么调出来
    loss曲线和accuracy曲线是从哪里看啊
  • [问题求助] mdc 编码问题
    请问下文档中的ImageData结构体中的rawData 图像数据指针 mbufData Mbuf数据指针 这两个数据有啥区别呢?,是1)、里面存的东西是一样的,只是存储的位置不一样?2)、里面的数据不一样,存储的位置也不一样。文档中没有详细的说明。