|
|
@@ -4,15 +4,34 @@ utils/initialization |
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def notebook_init():
|
|
|
|
# For YOLOv5 notebooks
|
|
|
|
def notebook_init(verbose=True):
|
|
|
|
# Check system software and hardware
|
|
|
|
print('Checking setup...')
|
|
|
|
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
from utils.general import check_requirements, emojis, is_colab
|
|
|
|
from utils.torch_utils import select_device # imports
|
|
|
|
|
|
|
|
check_requirements(('psutil', 'IPython'))
|
|
|
|
import psutil
|
|
|
|
from IPython import display # to display images and clear console output
|
|
|
|
|
|
|
|
from utils.general import emojis
|
|
|
|
from utils.torch_utils import select_device # YOLOv5 imports
|
|
|
|
if is_colab():
|
|
|
|
shutil.rmtree('sample_data', ignore_errors=True) # remove colab /sample_data directory
|
|
|
|
|
|
|
|
if verbose:
|
|
|
|
# System info
|
|
|
|
# gb = 1 / 1000 ** 3 # bytes to GB
|
|
|
|
gib = 1 / 1024 ** 3 # bytes to GiB
|
|
|
|
ram = psutil.virtual_memory().total
|
|
|
|
total, used, free = shutil.disk_usage("/")
|
|
|
|
display.clear_output()
|
|
|
|
s = f'({os.cpu_count()} CPUs, {ram * gib:.1f} GB RAM, {(total - free) * gib:.1f}/{total * gib:.1f} GB disk)'
|
|
|
|
else:
|
|
|
|
s = ''
|
|
|
|
|
|
|
|
display.clear_output()
|
|
|
|
select_device(newline=False)
|
|
|
|
print(emojis('Setup complete ✅'))
|
|
|
|
print(emojis(f'Setup complete ✅ {s}'))
|
|
|
|
return display
|