Showing the changes to tools (3 of 3 files). Show all
Unified · Split
| @@ -22,7 +22,7 @@ class GroundTruth(MotionEST): · 21 unmodified lines | ||
| 22 | 22 | self.name = 'ground truth' |
| 23 | 23 | super(GroundTruth, self).__init__(cur_f, ref_f, blk_sz) |
| 24 | 24 | self.mask = np.zeros((self.num_row, self.num_col), dtype=np.bool) |
| 25 | − if not gt_path is None: | |
| 25 | + if gt_path: | |
| 26 | 26 | with open(gt_path) as gt_file: |
| 27 | 27 | lines = gt_file.readlines() |
| 28 | 28 | for i in xrange(len(lines)): |
| @@ -67,7 +67,7 @@ class MotionEST(object): · 66 unmodified lines | ||
| 67 | 67 | count = 0 |
| 68 | 68 | for i in xrange(self.num_row): |
| 69 | 69 | for j in xrange(self.num_col): |
| 70 | − if not mask is None and mask[i, j]: | |
| 70 | + if mask is not None and mask[i, j]: | |
| 71 | 71 | continue |
| 72 | 72 | loss += self.block_dist(i, j, self.mf[i, j], metric) |
| 73 | 73 | count += 1 |
| @@ -82,7 +82,7 @@ class MotionEST(object): · 8 unmodified lines | ||
| 82 | 82 | mask = ground_truth.mask |
| 83 | 83 | for i in xrange(self.num_row): |
| 84 | 84 | for j in xrange(self.num_col): |
| 85 | − if not mask is None and mask[i][j]: | |
| 85 | + if mask is not None and mask[i][j]: | |
| 86 | 86 | continue |
| 87 | 87 | loss += LA.norm(gt[i, j] - self.mf[i, j]) |
| 88 | 88 | count += 1 |
| @@ -101,7 +101,7 @@ class MotionEST(object): · 12 unmodified lines | ||
| 101 | 101 | plt.subplot(1, n_row, 1) |
| 102 | 102 | plt.imshow(cur_mf) |
| 103 | 103 | plt.title('Estimated Motion Field') |
| 104 | − if not ground_truth is None: | |
| 104 | + if ground_truth is not None: | |
| 105 | 105 | plt.subplot(1, n_row, 2) |
| 106 | 106 | plt.imshow(gt_mf) |
| 107 | 107 | plt.title('Ground Truth') |
| @@ -57,7 +57,7 @@ if __name__ == "__main__": · 56 unmodified lines | ||
| 57 | 57 | else: |
| 58 | 58 | frames.append((idx, img)) |
| 59 | 59 | if len(frames) == 0: |
| 60 | − print "No frames in directory: " + args.frame_path | |
| 60 | + print("No frames in directory: " + args.frame_path) | |
| 61 | 61 | sys.exit() |
| 62 | 62 | print("----------------------Y4M Info----------------------") |
| 63 | 63 | print("width: %d" % frames[0][1].width) |