Skip to content

Commit

Permalink
* 注释掉部分输出
Browse files Browse the repository at this point in the history
  • Loading branch information
jadehh committed Feb 23, 2023
1 parent 657126a commit b052a10
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 43 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
10 changes: 5 additions & 5 deletions acllite/acllite_imageproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions acllite/acllite_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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" %
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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()
13 changes: 6 additions & 7 deletions acllite/acllite_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def init(self):
"""
init resource
"""
print("init resource stage:")

ret = acl.init()
utils.check_ret("acl.init", ret)

Expand All @@ -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")
10 changes: 6 additions & 4 deletions acllite/dvpp_vdec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion acllite/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# @Email : [email protected]
# @Software : Samples
# @Desc :
version = "1.0.2"
version = "1.0.3"
28 changes: 14 additions & 14 deletions acllite/videocapture.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand All @@ -241,16 +241,16 @@ 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):
in_frame_np = np.frombuffer(packet.to_bytes(), np.byte)
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

Expand Down
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)):
Expand All @@ -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,
Expand Down

0 comments on commit b052a10

Please sign in to comment.