From b052a104209ed96e5c2c9308299cb9c161d3ab0d Mon Sep 17 00:00:00 2001 From: jade Date: Thu, 23 Feb 2023 10:28:48 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E6=B3=A8=E9=87=8A=E6=8E=89=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++-- acllite/acllite_imageproc.py | 10 +++++----- acllite/acllite_model.py | 12 ++++++------ acllite/acllite_resource.py | 13 ++++++------- acllite/dvpp_vdec.py | 10 ++++++---- acllite/version.py | 2 +- acllite/videocapture.py | 28 ++++++++++++++-------------- setup.py | 7 +++---- 8 files changed, 44 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index 771f15bf..89a67e10 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ -## Acllite v1.0.2 +## Acllite v1.0.3 ### 更新日志 +* 注释掉部分输出 * update 新增AclliteImage转cv2 Image ### 打包成wheel ```bash -pip wheel --wheel-dir=./wheel_dir ./ +python setup.py sdist bdist_wheel ``` \ No newline at end of file diff --git a/acllite/acllite_imageproc.py b/acllite/acllite_imageproc.py index 1903db65..1389aa7e 100644 --- a/acllite/acllite_imageproc.py +++ b/acllite/acllite_imageproc.py @@ -217,7 +217,7 @@ def crop_and_paste( """ crop_and_paste """ - print('[AclLiteImageProc] vpc crop and paste stage:') + # print('[AclLiteImageProc] vpc crop and paste stage:') input_desc = self._gen_input_pic_desc(image) stride_width = utils.align_up16(crop_and_paste_width) stride_height = utils.align_up2(crop_and_paste_height) @@ -258,7 +258,7 @@ def crop_and_paste( utils.check_ret("acl.media.dvpp_vpc_crop_and_paste_async", ret) ret = acl.rt.synchronize_stream(self._stream) utils.check_ret("acl.rt.synchronize_stream", ret) - print('[AclLiteImageProc] vpc crop and paste stage success') + # print('[AclLiteImageProc] vpc crop and paste stage success') stride_width = crop_and_paste_width - 2 * dx stride_height = crop_and_paste_height - 2 * dy acl.media.dvpp_destroy_pic_desc(input_desc) @@ -282,7 +282,7 @@ def crop_and_paste_get_roi( :crop_and_paste_height: crop_and_paste_height :return: return AclLiteImage """ - print('[AclLiteImageProc] vpc crop and paste stage:') + # print('[AclLiteImageProc] vpc crop and paste stage:') input_desc = self._gen_input_pic_desc(image) stride_width = utils.align_up16(crop_and_paste_width) stride_height = utils.align_up2(crop_and_paste_height) @@ -306,7 +306,7 @@ def crop_and_paste_get_roi( utils.check_ret("acl.media.dvpp_vpc_crop_and_paste_async", ret) ret = acl.rt.synchronize_stream(self._stream) utils.check_ret("acl.rt.synchronize_stream", ret) - print('[AclLiteImageProc] vpc crop and paste stage success') + # print('[AclLiteImageProc] vpc crop and paste stage success') stride_width = utils.align_up16(crop_and_paste_width) stride_height = utils.align_up2(crop_and_paste_height) acl.media.dvpp_destroy_pic_desc(input_desc) @@ -350,7 +350,7 @@ def jpege(self, image): # Wait for the conversion to complete ret = acl.rt.synchronize_stream(self._stream) if (ret != constants.ACL_SUCCESS): - print("Jpege synchronize stream, failed, ret ", ret) + # print("Jpege synchronize stream, failed, ret ", ret) return None # Release resources acl.media.dvpp_destroy_pic_desc(input_desc) diff --git a/acllite/acllite_model.py b/acllite/acllite_model.py index bf607706..b450843a 100644 --- a/acllite/acllite_model.py +++ b/acllite/acllite_model.py @@ -46,7 +46,7 @@ def __init__(self, model_path, load_type=0): resource_list.register(self) def _init_resource(self): - log_info("Init model resource start...") + # log_info("Init model resource start...") if not os.path.isfile(self._model_path): log_error( "model_path failed, please check. model_path=%s" % @@ -83,12 +83,12 @@ def _init_resource(self): # recode input data address,if need malloc memory,the memory will be # reuseable self._init_input_buffer() - log_info("Init model resource success") + # log_info("Init model resource success") return const.SUCCESS def _gen_output_dataset(self, ouput_num): - log_info("[AclLiteModel] create model output dataset:") + # log_info("[AclLiteModel] create model output dataset:") dataset = acl.mdl.create_dataset() for i in range(ouput_num): # malloc device memory for output @@ -98,13 +98,13 @@ def _gen_output_dataset(self, ouput_num): # crate oputput data buffer dataset_buffer = acl.create_data_buffer(buf, size) _, ret = acl.mdl.add_dataset_buffer(dataset, dataset_buffer) - log_info("malloc output %d, size %d" % (i, size)) + # log_info("malloc output %d, size %d" % (i, size)) if ret: acl.rt.free(buf) acl.destroy_data_buffer(dataset_buffer) utils.check_ret("acl.destroy_data_buffer", ret) self._output_dataset = dataset - log_info("Create model output dataset success") + # log_info("Create model output dataset success") def _init_input_buffer(self): self._input_num = acl.mdl.get_num_inputs(self._model_desc) @@ -439,7 +439,7 @@ def destroy(self): self._is_destroyed = True resource_list.unregister(self) - log_info("AclLiteModel release source success") + # log_info("AclLiteModel release source success") def __del__(self): self.destroy() diff --git a/acllite/acllite_resource.py b/acllite/acllite_resource.py index aa3054d9..6444162d 100644 --- a/acllite/acllite_resource.py +++ b/acllite/acllite_resource.py @@ -75,7 +75,7 @@ def init(self): """ init resource """ - print("init resource stage:") + ret = acl.init() utils.check_ret("acl.init", ret) @@ -91,20 +91,19 @@ def init(self): self.run_mode, ret = acl.rt.get_run_mode() utils.check_ret("acl.rt.get_run_mode", ret) - print("Init resource success") def __del__(self): - print("acl resource release all resource") + # print("acl resource release all resource") resource_list.destroy() if self.stream: - print("acl resource release stream") + # print("acl resource release stream") acl.rt.destroy_stream(self.stream) if self.context: - print("acl resource release context") + # print("acl resource release context") acl.rt.destroy_context(self.context) - print("Reset acl device ", self.device_id) + # print("Reset acl device ", self.device_id) acl.rt.reset_device(self.device_id) acl.finalize() - print("Release acl resource success") + # print("Release acl resource success") diff --git a/acllite/dvpp_vdec.py b/acllite/dvpp_vdec.py index ccce556e..8cd74f8f 100644 --- a/acllite/dvpp_vdec.py +++ b/acllite/dvpp_vdec.py @@ -77,13 +77,14 @@ def _callback(self, input_stream_desc, output_pic_desc, user_data): self._get_pic_desc_data(output_pic_desc, user_data) def _get_pic_desc_data(self, pic_desc, user_data): - pic_data = acl.media.dvpp_get_pic_desc_data(pic_desc) + pic_data = acl.media.dvpp.\ + _get_pic_desc_data(pic_desc) pic_data_size = acl.media.dvpp_get_pic_desc_size(pic_desc) ret_code = acl.media.dvpp_get_pic_desc_ret_code(pic_desc) if ret_code: channel_id, frame_id = user_data - acl_log.log_error("Decode channel %d frame %d failed, error %d" - % (channel_id, frame_id, ret_code)) + # acl_log.log_error("Decode channel %d frame %d failed, error %d" + # % (channel_id, frame_id, ret_code)) acl.media.dvpp_free(pic_data) else: image = AclLiteImage(pic_data, self._width, self._height, 0, 0, @@ -241,7 +242,8 @@ def read(self, no_wait=False): try: image = self._frame_queue.get_nowait() except queue.Empty: - acl_log.log_info("No decode frame in queue anymore") + pass + # acl_log.log_info("No decode frame in queue anymore") else: try: image = self._frame_queue.get(timeout=READ_TIMEOUT) diff --git a/acllite/version.py b/acllite/version.py index bdff0ba5..cc59f8b3 100644 --- a/acllite/version.py +++ b/acllite/version.py @@ -6,4 +6,4 @@ # @Email : jadehh@1ive.com # @Software : Samples # @Desc : -version = "1.0.2" \ No newline at end of file +version = "1.0.3" \ No newline at end of file diff --git a/acllite/videocapture.py b/acllite/videocapture.py index 8fd89523..9abc43ab 100644 --- a/acllite/videocapture.py +++ b/acllite/videocapture.py @@ -132,7 +132,7 @@ def _open(self): if self._status == DECODE_STATUS_READY: self._is_opened = True - acl_log.log_info("Ready to decode %s..." % (self._stream_name)) + # acl_log.log_info("Ready to decode %s..." % (self._stream_name)) else: acl_log.log_error("Open %s failed for wait ready timeout" % (self._stream_name)) @@ -161,15 +161,15 @@ def _get_param(self): self._width = video_context.width self._height = video_context.height - acl_log.log_info( - "Get %s infomation: width %d, height %d, profile %d, " - "codec %s, entype %d" % - (self._stream_name, - self._width, - self._height, - profile, - codec_id_name, - self._entype)) + # acl_log.log_info( + # "Get %s infomation: width %d, height %d, profile %d, " + # "codec %s, entype %d" % + # (self._stream_name, + # self._width, + # self._height, + # profile, + # codec_id_name, + # self._entype)) container.close() @@ -223,7 +223,7 @@ def _pyav_vdec(self): frame = 0 video = av.open(self._stream_name) stream = [s for s in video.streams if s.type == 'video'] - acl_log.log_info("Start decode %s frames" % (self._stream_name)) + # acl_log.log_info("Start decode %s frames" % (self._stream_name)) for packet in video.demux([stream[0]]): # Get frame data from packet and copy to dvpp frame_data, data_size = self._prepare_frame_data(packet) @@ -241,8 +241,8 @@ def _pyav_vdec(self): # The status chang to stop when app stop decode if self._status != DECODE_STATUS_RUNNING: - acl_log.log_info("Decode status change to %d, stop decode" - % (self._status)) + # acl_log.log_info("Decode status change to %d, stop decode" + # % (self._status)) break def _prepare_frame_data(self, packet): @@ -250,7 +250,7 @@ def _prepare_frame_data(self, packet): size = in_frame_np.size if size == 0: # Last frame data is empty - acl_log.log_info("Pyav decode finish") + # acl_log.log_info("Pyav decode finish") self._status = DECODE_STATUS_PYAV_FINISH return None, 0 diff --git a/setup.py b/setup.py index a764c367..e98045e1 100644 --- a/setup.py +++ b/setup.py @@ -8,9 +8,8 @@ # @Desc : from setuptools import setup import os -with open("README.md","r") as fh: - long_description = fh.read() - +with open("acllite/README.md","rb") as fh: + long_description = str(fh.read(),encoding="utf-8") def find_packages(path,pack_list): for file_path in os.listdir(path): if os.path.isdir(os.path.join(path,file_path)): @@ -28,7 +27,7 @@ def find_packages(path,pack_list): find_packages("acllite",pack_list) setup( name="acllite", - version="1.0.2", + version="1.0.3", keywords=("pip", "acllite", ""), description="acllite", long_description=long_description,