importwizzi_utilsaswu# pip install wizzi_utils# The above import, will give access to all wizzi utils main module and the extra modules # only if the packages are installedprint(wu.to_str(var=2, title='my_int')) # this will 100% workwu.test.to_str_test() # for a wide example of to_str functionprint(wu.tt.to_str(var=3, title='my_int')) # tt for torch tools. will work if torch installedwu.tt.test.to_str_test() # for a wide example of tt.to_str function# If facing packages issues and want to know what packages I used, call the followingwu.download_wizzi_utils_env_snapshot() # updated on 10/10/2022
list of all the packages
importwizzi_utilsaswuwu.test.test_all() # main module - all function that dont require extra installations but wizzi_utilswu.jt.test.test_all() # json tools wu.cvt.test.test_all() # cv2 tools wu.pyplt.test.test_all() # pyplot tools wu.st.test.test_all() # socket toolswu.tt.test.test_all() # torch tools wu.tflt.test.test_all() # tensorflow lite toolswu.tts.test.test_all() # text to speach toolswu.models.test.test_all() # models - cv2 and tf lite models. tracking, object detection and pose estimationwu.got.test.test_all() # google drive tools - work in progress
Some examples
importwizzi_utilsaswu"""* wu.main_wrapper()* Extremely useful if run experiments and want to have the meta data saved* e.g. the interpreter, the time, the pc details ..."""defmain():
msg="Hello world in red "msg+=wu.get_emoji(wu.EMOJIS.SMILING_FACE_WITH_3_HEARTS)
msg=wu.add_color(string=msg, ops=['Red', 'bold', 'underlined'])
print(msg)
# wu.test.add_color_test()# wu.test.get_emoji_test()returnif__name__=='__main__':
wu.main_wrapper(
main_function=main,
seed=42,
ipv4=True,
cuda_off=False,
nvid_gpu=True,
torch_v=True,
tf_v=True,
cv2_v=True,
with_pip_list=False,
with_profiler=False
)
importwizzi_utilsaswu# fps measurements:fps=wu.FPS(last_k=3, cache_size=5, summary_title='classFPS_test')
fortinrange(10):
ack= (t+1) %2==0# display only on even roundsfps.start(ack_progress=False)
# do_work of round twu.sleep(seconds=0.03)
ift==0: # e.g. slow first iterationwu.sleep(seconds=1)
fps.update(ack_progress=ack)
ift==5:
print('\tget_fps() = {:.4f}'.format(fps.get_fps()))
fps.finalize()
importwizzi_utilsaswu"""* cv2 show image with extra control:* concatenation of several images(e.g. 2 cameras frames)* display in a grid (2x1 1x2 3x3)* resize (0.3 -> 30%, (200, 400)->total image to (200, 400), fs for full screen* window location* and more..."""img_utl='https://cdn.sstatic.net/Sites/stackoverflow/img/logo.png'wu.st.download_file(url=img_utl, dst_path='./so_logo.png') # st for socket toolsbgr=wu.cvt.load_img(path='./so_logo.png', ack=True)
gray=wu.cvt.bgr_to_gray(bgr)
rgb=wu.cvt.bgr_to_rgb(bgr)
wu.cvt.add_header(bgr, header='bgr', loc='bl', text_color='lime')
wu.cvt.add_header(gray, header='gray', loc='bl')
wu.cvt.add_header(rgb, header='rgb', loc='bl', text_color='aqua')
wu.cvt.display_open_cv_images(
imgs=[bgr, gray, rgb],
ms=0,
title='display images',
loc='bc', # bottom centerresize=1.5, # 150%grid=(3, 1), # 3 rows 1 colheader='cool, no?',
separator_c='aqua',
)
The Tidelift Subscription provides access to a continuously curated stream of human-researched and maintainer-verified data on open source packages and their licenses, releases, vulnerabilities, and development practices.