Skip to content

Commit

Permalink
add batchsize adjustment in 2dassess
Browse files Browse the repository at this point in the history
  • Loading branch information
yilaili committed May 8, 2020
1 parent 1e3c1d0 commit df9ffe7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cryoassess/assess2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def setupParserOptions():
help="Input mrcs file of 2D class averages.")
ap.add_argument('-m', '--model', default='./models/2dassess_062119.h5',
help='Path to the model.h5 file.')
ap.add_argument('-b', '--batch_size', type=int, default=32,
help="Batch size used in prediction. Default is 32. If memory error/warning appears, try lower this number to 16, 8, or even lower.")
ap.add_argument('-n', '--name', default='particle',
help="Name of the particle. Default is particle.")
ap.add_argument('-o', '--output', default='2DAssess',
Expand All @@ -54,6 +56,7 @@ def w_categorical_crossentropy(y_true, y_pred, weights):
def predict(**args):
print('Assessing 2D class averages with 2DAssess....')
test_data_dir = os.path.abspath(args['output'])
batch_size = args['batch_size']
labels = ['Clip', 'Edge', 'Good', 'Noise']
os.chdir(test_data_dir)
for l in labels:
Expand All @@ -75,7 +78,7 @@ def predict(**args):
test_data_dir,
shuffle=False,
target_size=(256, 256),
batch_size=32,
batch_size=batch_size,
color_mode='grayscale',
class_mode=None,
interpolation='lanczos')
Expand Down

0 comments on commit df9ffe7

Please sign in to comment.