check_git_status() to train.py
This commit is contained in:
+8
-7
@@ -17,16 +17,10 @@ from tqdm import tqdm
|
||||
|
||||
from . import torch_utils # , google_utils
|
||||
|
||||
matplotlib.rc('font', **{'size': 11})
|
||||
|
||||
# Suggest 'git pull'
|
||||
s = subprocess.check_output('if [ -d .git ]; then git status -uno; fi', shell=True).decode('utf-8')
|
||||
if 'Your branch is behind' in s:
|
||||
print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n')
|
||||
|
||||
# Set printoptions
|
||||
torch.set_printoptions(linewidth=320, precision=5, profile='long')
|
||||
np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format}) # format short g, %precision=5
|
||||
matplotlib.rc('font', **{'size': 11})
|
||||
|
||||
# Prevent OpenCV from multithreading (to use PyTorch DataLoader)
|
||||
cv2.setNumThreads(0)
|
||||
@@ -38,6 +32,13 @@ def init_seeds(seed=0):
|
||||
torch_utils.init_seeds(seed=seed)
|
||||
|
||||
|
||||
def check_git_status():
|
||||
# Suggest 'git pull' if repo is out of date
|
||||
s = subprocess.check_output('if [ -d .git ]; then git fetch && git status -uno; fi', shell=True).decode('utf-8')
|
||||
if 'Your branch is behind' in s:
|
||||
print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n')
|
||||
|
||||
|
||||
def load_classes(path):
|
||||
# Loads *.names file at 'path'
|
||||
with open(path, 'r') as f:
|
||||
|
||||
Reference in New Issue
Block a user