This commit is contained in:
charlesbvll 2021-04-25 10:29:03 +02:00
parent 3458cc58e9
commit e94c8458f0
5 changed files with 7 additions and 10 deletions

View File

@ -273,5 +273,4 @@ def create_empty_files(dir_out, net):
for i in range(7481): for i in range(7481):
name = "0" * (6 - len(str(i))) + str(i) + '.txt' name = "0" * (6 - len(str(i))) + str(i) + '.txt'
ff = open(os.path.join(dir_out[net], name), "a+") with open(os.path.join(dir_out[net], name), "a+"): pass
ff.close()

View File

@ -48,7 +48,7 @@ def cli():
visualizer.cli(parser) visualizer.cli(parser)
# Monoloco # Monoloco
predict_parser.add_argument('--activities', nargs='+', predict_parser.add_argument('--activities', nargs='+',
help='Choose activities to show: social_distance, raise_hand') help='Choose activities to show: social_distance, raise_hand')
predict_parser.add_argument('--mode', help='keypoints, mono, stereo', default='mono') predict_parser.add_argument('--mode', help='keypoints, mono, stereo', default='mono')
predict_parser.add_argument('--model', help='path of MonoLoco/MonStereo model to load') predict_parser.add_argument('--model', help='path of MonoLoco/MonStereo model to load')

View File

@ -161,8 +161,7 @@ def read_and_rewrite(path_orig, path_new):
line_new = temp_1 + ' ' + hwl + ' ' + temp_2 + '\n' line_new = temp_1 + ' ' + hwl + ' ' + temp_2 + '\n'
ff.write("%s" % line_new) ff.write("%s" % line_new)
except FileNotFoundError: except FileNotFoundError:
ff = open(path_new, "a+") with open(path_new, "a+"): pass
ff.close()
def find_cluster(dd, clusters): def find_cluster(dd, clusters):

View File

@ -109,11 +109,11 @@ class KeypointPainter:
for ci, connection in enumerate(np.array(self.skeleton) - 1): for ci, connection in enumerate(np.array(self.skeleton) - 1):
c = color c = color
linewidth=self.linewidth linewidth=self.linewidth
if ((connection[0] == 5 and connection[1] == 7) if ((connection[0] == 5 and connection[1] == 7)
or (connection[0] == 7 and connection[1] == 9)) and raise_hand in ['left','both']: or (connection[0] == 7 and connection[1] == 9)) and raise_hand in ['left','both']:
c = 'yellow' c = 'yellow'
linewidth = l_arm_width linewidth = l_arm_width
if ((connection[0] == 6 and connection[1] == 8) if ((connection[0] == 6 and connection[1] == 8)
or (connection[0] == 8 and connection[1] == 10)) and raise_hand in ['right', 'both']: or (connection[0] == 8 and connection[1] == 10)) and raise_hand in ['right', 'both']:
c = 'yellow' c = 'yellow'
linewidth = r_arm_width linewidth = r_arm_width
@ -192,7 +192,7 @@ class KeypointPainter:
matplotlib.patches.Rectangle( matplotlib.patches.Rectangle(
(x - scale, y - scale), 2 * scale, 2 * scale, fill=False, color=color)) (x - scale, y - scale), 2 * scale, 2 * scale, fill=False, color=color))
def keypoints(self, ax, keypoint_sets, *, def keypoints(self, ax, keypoint_sets, *,
size=None, scores=None, color=None, colors=None, texts=None, raise_hand='none'): size=None, scores=None, color=None, colors=None, texts=None, raise_hand='none'):
if keypoint_sets is None: if keypoint_sets is None:
return return
@ -443,4 +443,3 @@ def social_distance_colors(colors, dic_out):
# Prepare color for social distancing # Prepare color for social distancing
colors = ['r' if flag else colors[idx] for idx,flag in enumerate(dic_out['social_distance'])] colors = ['r' if flag else colors[idx] for idx,flag in enumerate(dic_out['social_distance'])]
return colors return colors

View File

@ -248,7 +248,7 @@ class Printer:
if not self.args.activities or 'social_distance' not in self.args.activities: if not self.args.activities or 'social_distance' not in self.args.activities:
self.mpl_im0.set_data(image) self.mpl_im0.set_data(image)
self._front_loop(iterator, axes, number, colors, annotations, dic_out) self._front_loop(iterator, axes, number, colors, annotations, dic_out)
# Draw the bird figure # Draw the bird figure
number['num'] = 97 number['num'] = 97