|
130 | 130 | # run as worker only |
131 | 131 | CLUSTER_WORKERONLY = os.getenv('CLUSTER_WORKERONLY', False) |
132 | 132 |
|
| 133 | +HAS_OPENCL = os.getenv('HAS_OPENCL', 'true') |
133 | 134 | SAVE_ORIGINAL_FACE = False |
134 | 135 | original_face_img_path = os.path.join(BASEDIR, 'data', 'original_face_img') |
135 | 136 | if not os.path.exists(original_face_img_path): |
|
142 | 143 |
|
143 | 144 | counter = 0 |
144 | 145 |
|
| 146 | +if HAS_OPENCL == 'false': |
| 147 | + print('need init mxnet') |
| 148 | + mod = FaceProcessing.init_embedding_processor() |
| 149 | + print("start to warm up") |
| 150 | + embedding = FaceProcessing.FaceProcessingImageData2(os.path.join(BASEDIR,"image","Mike_Alden_0001_tmp.png")) |
| 151 | + print("warmed up") |
| 152 | + |
| 153 | + |
145 | 154 | def featureCalculation(imgpath): |
146 | 155 | img = misc.imread(os.path.expanduser(imgpath)) |
147 | 156 | prewhitened = facenet.prewhiten(img) |
@@ -1638,11 +1647,11 @@ def setup(sender=None, **kwargs): |
1638 | 1647 | check_groupid_changed() |
1639 | 1648 | init_fs() |
1640 | 1649 |
|
1641 | | - |
1642 | | - mod = FaceProcessing.init_embedding_processor() |
1643 | | - print("start to warm up") |
1644 | | - embedding = featureCalculation2(os.path.join(BASEDIR,"image","Mike_Alden_0001_tmp.png")) |
1645 | | - print("warmed up") |
| 1650 | + if HAS_OPENCL == 'true': |
| 1651 | + mod = FaceProcessing.init_embedding_processor() |
| 1652 | + print("start to warm up") |
| 1653 | + embedding = featureCalculation2(os.path.join(BASEDIR,"image","Mike_Alden_0001_tmp.png")) |
| 1654 | + print("warmed up") |
1646 | 1655 | #if embedding is not None: |
1647 | 1656 | # print("worker embedding ready") |
1648 | 1657 |
|
|
0 commit comments