File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 42
42
#import judgeutil
43
43
44
44
BASEDIR = os .getenv ('RUNTIME_BASEDIR' ,os .path .abspath (os .path .dirname (__file__ )))
45
+
46
+
47
+ HAS_OPENCL = os .getenv ('HAS_OPENCL' ,'true' )
45
48
sys .path .append (BASEDIR )
46
49
import judgeutil
47
50
@@ -363,7 +366,10 @@ def train_svm_with_embedding(args_list):
363
366
judge_paths = paths
364
367
judge_labels = labels
365
368
judge_nrof_images = len (judge_paths )
366
- judge_emb_array = np .zeros ((judge_nrof_images , 512 ))
369
+ if HAS_OPENCL == 'true :
370
+ judge_emb_array = np .zeros ((judge_nrof_images , 512 ))
371
+ else :
372
+ judge_emb_array = np .zeros ((judge_nrof_images , 128 ))
367
373
for j in range (judge_nrof_images ):
368
374
judge_embedding = None
369
375
image_path = judge_paths [j ]
@@ -390,7 +396,10 @@ def train_svm_with_embedding(args_list):
390
396
nrof_images = len (paths )
391
397
nrof_batches_per_epoch = int (math .ceil (1.0 * nrof_images / args .batch_size ))
392
398
393
- emb_array = np .zeros ((nrof_images , 512 ))
399
+ if HAS_OPENCL == 'true' :
400
+ emb_array = np .zeros ((nrof_images , 512 ))
401
+ else :
402
+ emb_array = np .zeros ((nrof_images , 128 ))
394
403
for i in range (nrof_batches_per_epoch ):
395
404
start_index = i * args .batch_size
396
405
end_index = min ((i + 1 )* args .batch_size , nrof_images )
You can’t perform that action at this time.
0 commit comments