当前位置: 首页 > news >正文

百度seo网站在线诊断网站建设对比

百度seo网站在线诊断,网站建设对比,layui+wordpress,wordpress生成海报图片插件1.1根据txt格式标签生成Label图片 (1) 经过测试验证#xff0c;使用python代码或者halcon代码生成的Label图片是一样的。但要注意#xff0c;最后要生成png格式的Label图片。 (2) 使用python代码生成Label图片 import cv2 import os import numpy as npdef gen_label_img(…1.1根据txt格式标签生成Label图片 (1) 经过测试验证使用python代码或者halcon代码生成的Label图片是一样的。但要注意最后要生成png格式的Label图片。 (2) 使用python代码生成Label图片 import cv2 import os import numpy as npdef gen_label_img(img_path, txt_label_path, png_label_path):img_file_name os.path.basename(img_path).split(.jpg)[0]print(img_file_name)img cv2.imread(img_path)h, w img.shape[:2]mask np.zeros((h, w), dtypenp.uint8)with open(txt_label_path, r) as f:for line in f.readlines():class_id, *pyly line.strip().split( )pyly [float(i) for i in pyly]pyly np.array(pyly).reshape(-1, 2)# 根据h,w进行反归一化pyly (pyly * np.array([w, h])).astype(np.int32)print()mask cv2.drawContours(mask, [pyly], -1, (int(class_id) 255, int(class_id) 255, int(class_id) 255), -1)cv2.imwrite(png_label_path / img_file_name.png, mask)if __name__ __main__:img_path1 r./DataImage/train/txt_label_path1 r./DataLabel/txtlabel/train/png_label_path r./DataLabel/pnglabel/train2print(os.listdir(img_path1))for img_file in os.listdir(img_path1):img_path2 img_path1 img_fileprint(img_path2)txt_label_path2 txt_label_path1 img_file.split(.)[0] .txtgen_label_img(img_path2, txt_label_path2, png_label_path)(3) 使用halcon代码生成Label图片 img_path:./DataImage/train txt_path:./DataLabel/txtlabel/train label_path:./DataLabel/pnglabel/train1 list_image_files (img_path, default, [], ImageFiles)for i: 0 to |ImageFiles|-1 by 1read_image (Image1, ImageFiles[i])get_image_size (Image1, Width, Height)gen_image_const(ImageResult,byte,Width,Height) parse_filename (ImageFiles[i], BaseName, Extension, Directory)txt_file_path: txt_path/BaseName.txtlabel_file_path:label_path/BaseNameopen_file (txt_file_path, input, FileHandle)repeatfread_line(FileHandle, oneline, IsEOF)if(IsEOF 1)break endifif(oneline or oneline\n)continueendiftuple_regexp_replace (oneline, \n, , oneline)tuple_split (oneline, , Substrings)tuple_number (Substrings, Number)Points:Number[1:|Number|-1] tuple_select (Points, [0:2:|Points|-1], Selected1)tuple_select (Points, [1:2:|Points|], Selected2)c: Selected1*Widthr: Selected2*Heightgen_region_polygon_filled (Region, r, c)paint_region (Region, ImageResult, ImageResult, 255, fill)until (IsEOF)write_image (ImageResult, png, 0,label_file_path)endfor 1.2应用示例代码 * * *** 0) SET INPUT/OUTPUT PATHS AND DATASET PARAMETERS *** * ImageDir : pill SegmentationDir : labels/pill * OutputDir : segment_pill_defects_data * ClassNames : [good, contamination, crack] ClassIDs : [0, 1, 2] * Set to true, if the results should be deleted after running this program. RemoveResults : false * * *** 1.) PREPARE *** * * Read and prepare the DLDataset. read_dl_dataset_segmentation (ImageDir, SegmentationDir, ClassNames, ClassIDs, [], [], [], DLDataset) split_dl_dataset (DLDataset, 60, 20, []) * Here, existing preprocessed data will be overwritten if necessary. PreprocessSettings : dict{overwrite_files: auto} create_dl_preprocess_param (segmentation, 400, 400, 3, -127, 128, none, full_domain, [], [], [], [], DLPreprocessParam) preprocess_dl_dataset (DLDataset, OutputDir, DLPreprocessParam, PreprocessSettings, DLDatasetFileName) * * Inspect 10 randomly selected preprocessed DLSamples visually. WindowDict : dict{} find_dl_samples (DLDataset.samples, split, train, match, TrainSampleIndices) for Index : 0 to 9 by 1SampleIndex : TrainSampleIndices[round(rand(1) * (|TrainSampleIndices| - 1))]read_dl_samples (DLDataset, SampleIndex, DLSample)dev_display_dl_data (DLSample, [], DLDataset, [segmentation_image_ground_truth, segmentation_weight_map], [], WindowDict)dev_disp_text (Press F5 to continue, window, bottom, right, black, [], [])stop () endfor dev_close_window_dict (WindowDict) * * *** 2.) TRAIN *** * * Read a pretrained model and adapt its parameters * according to the dataset. read_dl_model (pretrained_dl_segmentation_compact.hdl, DLModelHandle) set_dl_model_param_based_on_preprocessing (DLModelHandle, DLPreprocessParam, ClassIDs) set_dl_model_param (DLModelHandle, class_names, ClassNames) * Set training related model parameters. * Training can be performed on a GPU or CPU. * See the respective system requirements in the Installation Guide. * If possible a GPU is used in this example. * In case you explicitly wish to run this example on the CPU, * choose the CPU device instead. query_available_dl_devices ([runtime, runtime], [gpu, cpu], DLDeviceHandles) if (|DLDeviceHandles| 0)throw (No supported device found to continue this example.) endif * Due to the filter used in query_available_dl_devices, the first device is a GPU, if available. DLDevice : DLDeviceHandles[0] get_dl_device_param (DLDevice, type, DLDeviceType) if (DLDeviceType cpu)* The number of used threads may have an impact* on the training duration.NumThreadsTraining : 4set_system (thread_num, NumThreadsTraining) endif * * For details see the documentation of set_dl_model_param () and get_dl_model_param (). if (DLDeviceType gpu)set_dl_model_param_max_gpu_batch_size (DLModelHandle, 50) endif set_dl_model_param (DLModelHandle, learning_rate, 0.0001) set_dl_model_param (DLModelHandle, device, DLDevice) * * Here, we run a short training of 10 epochs. * For better model performance increase the number of epochs * and train as long as your compute budget allows, * e.g., for 100, 1000 or 3000 epochs. create_dl_train_param (DLModelHandle, 10, 1, true, 42, [], [], TrainParam) * The training and thus the call of train_dl_model_batch () * is done using the following procedure. train_dl_model (DLDataset, DLModelHandle, TrainParam, 0, TrainResults, TrainInfos, EvaluationInfos) * * Read the best model, which is written to file by train_dl_model. read_dl_model (model_best.hdl, DLModelHandle) dev_disp_text (Press F5 to continue, window, bottom, left, black, [], []) stop () * dev_close_window () dev_close_window () * * *** 3.) EVALUATE *** * GenParamEval : dict{show_progress: true} GenParamEval.measures : [mean_iou, pixel_accuracy, class_pixel_accuracy, pixel_confusion_matrix] * set_dl_model_param (DLModelHandle, device, DLDevice) evaluate_dl_model (DLDataset, DLModelHandle, split, test, GenParamEval, EvaluationResult, EvalParams) * GenParamEvalDisplay : dict{display_mode: [measures, absolute_confusion_matrix]} dev_display_segmentation_evaluation (EvaluationResult, EvalParams, GenParamEvalDisplay, WindowDict) dev_disp_text (Press F5 to continue, window, bottom, right, black, [], []) stop () dev_close_window_dict (WindowDict) * * Optimize the model for inference, * meaning, reduce its memory consumption. set_dl_model_param (DLModelHandle, optimize_for_inference, true) set_dl_model_param (DLModelHandle, batch_size, 1) * Save the model in this optimized state. write_dl_model (DLModelHandle, model_best.hdl) * * *** 4.) INFER *** * * To demonstrate the inference steps, we apply the * trained model to some randomly chosen example images. list_image_files (ImageDir, default, recursive, ImageFiles) tuple_shuffle (ImageFiles, ImageFilesShuffled) * * Create dictionaries used in visualization. WindowDict : dict{} DLDatasetInfo : dict{} get_dl_model_param (DLModelHandle, class_ids, DLDatasetInfo.class_ids) get_dl_model_param (DLModelHandle, class_names, DLDatasetInfo.class_names) for IndexInference : 0 to 9 by 1read_image (Image, ImageFilesShuffled[IndexInference])gen_dl_samples_from_images (Image, DLSample)preprocess_dl_samples (DLSample, DLPreprocessParam)apply_dl_model (DLModelHandle, DLSample, [], DLResult)* dev_display_dl_data (DLSample, DLResult, DLDatasetInfo, [segmentation_image_result, segmentation_confidence_map], [], WindowDict)dev_disp_text (Press F5 to continue, window, bottom, right, black, [], [])stop () endfor dev_close_window_dict (WindowDict) * * *** 5.) REMOVE FILES *** * clean_up_output (OutputDir, RemoveResults)
http://www.zqtcl.cn/news/405277/

相关文章:

  • 做网站的收费标准社保网上服务大厅
  • php网站开发安全网站建设管理教程视频教程
  • 网站建设的空间是什么意思海络网站
  • 深圳华强北今晚网站优化推广公司
  • 网站建设行业好做吗太原网站改版
  • 寿光企业建站流程个人网站用什么软件
  • 网站建设与管理自考本全国卷wordpress 关闭文章修订
  • 兴义市建设局网站首页网站开发项目实训总结
  • 个人网站空间收费网络软文营销案例
  • 网站开发文件结构组成微网站移交
  • 西安全网优化 西安网站推广网页浏览器缩略词
  • 网站开发及企业推广营销型网站建设怎么收费
  • 网站建设与管理ppt课件百度云盘关键词推广营销
  • c asp.net网站开发书宁波建设业协会网站
  • 政务网站建设发言材料知名互联网公司有哪些
  • 网站搭建制作建e室内设计网画图
  • 重庆市建设工程施工安全管理信息网北京seo公司网站
  • 国外做调查问卷的网站建设邮费自己的网站 要不要购买服务器的
  • 网站建设和优化排名四川建设网官网证书查询入口
  • 如何搜名字搜到自己做的网站电子商务平台icp备案证明
  • 网站建设与管理工作内容北京网站建设价
  • 做网站选哪个语言软文营销的方法
  • 青岛正规公司网站建设公司中国建设银行注册网站
  • 免费个人网站平台关键词检索
  • 定制型网站建设推广宁河网站建设
  • 主流网站开发语言有哪些电子邮件营销
  • 扫描二维码进入公司网站怎样做在万网上域名了怎么做网站
  • 销售型网站设计怎么做网站广告位
  • 网站推广的方法ppt购物网站logo
  • 网站关键词分割wordpress为展示的作品投票