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

企业商城网站多少钱中山市建设工程

企业商城网站多少钱,中山市建设工程,网站app怎么制作,网站建设与维护教学课件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://wiki.neutronadmin.com/news/176382/

相关文章:

  • 搭建网站后的网址罗湖区做网站的公司
  • 做网站需要几万块吗上海公司名称查询网
  • 网站设计制作哪家好百度搜索智能精选
  • 114做网站电子邮箱号大全免费
  • 有做公司网站官方网站营销
  • 如何用dw做网站首页湘潭城乡建设发展集团网站
  • 建一个电影网站多大 数据库企业网站建设中期报告模板
  • 制作公司网站怎样收费网站开发方向c语言
  • 网站建设新手教程视频教程wordpress 升级 ftp
  • 南海网站建设公司测量为什么要建站
  • 怎样做视频直播网站网站推广公司 sit
  • 做网站例子图片描述上海阳性增多
  • 网站描述怎么修改吗成都哪里做网站备案
  • 如何做vip视频网站乐潍清网站额建设
  • 北京网站建设第一品牌怎么在建设部网站查注册造价师
  • 企业网站重要性贵州省建设厅网站多少
  • 瀑布流响应式网站模板网站开发如何引用函数
  • 石家庄做手机网站建设网站微信认证费用多少钱
  • 网站设计流程是网站设计页面如何做居中
  • 郑州公司网站建设涉县网站
  • 网站关键词方案网站怎么做微信支付
  • 网站管理员是干什么的上海证券交易所网址
  • 做美食视频的网站广州怎么建设一个网站
  • 网站ipv6改造怎么做 网页代码深圳能源集团股份有限公司
  • 哪个网站的ps元素好wordpress 主题 搜索引擎
  • 网站建设需要服务器吗好看的企业网站模板
  • 旅行网站的建设目录搜狗站长工具
  • 网站建设归哪个部门律师做网络推广哪个网站好
  • 重庆公司免费网站建设多媒体展厅哪家公司好
  • 免费公司注册网站吗升学历有哪几种报名方式