locked leveldb

8 views
Skip to first unread message

Tal

unread,
Jun 12, 2017, 6:57:35 AM6/12/17
to Caffe Users
Hello all,

I am new caffe user and I have a weird problem.
I am trying to run the following code:


#-------------------------------------------------------------------
def write_db(X, Y, fname):
    if os.path.exists(fname):
      shutil.rmtree(fname)
    assert X.shape[0] == Y.shape[0]
    X = X.reshape((X.shape[0], X.size/X.shape[0], 1, 1))
    db = leveldb.LevelDB(fname)

    for i in xrange(X.shape[0]):
      x = X[i]
      if x.ndim != 3:
        x = x.reshape((x.size,1,1))
      db.Put('{:08}'.format(i), caffe.io.array_to_datum(x, int(Y[i])).SerializeToString())
    del db

#-------------------------------------------------------------------
import numpy as np
import shutil
import random
import leveldb
import caffe
from google import protobuf
from caffe.proto import caffe_pb2
from xml.dom import minidom
import matplotlib.pyplot as plt
from scipy.spatial.distance import cdist
import cPickle
import time

print 'Preparing mnist data. This could take a while...'

 X, Y = load_mnist('../mnist/', True)
 X = X.astype(np.float64)*0.02
 write_db(X, Y, 'mnist_train')


#-------------------------------------------------------------------
I get the following error:

leveldb.LevelDBError: IO error: lock mnist_train/LOCK: Input/output error

This program worked before.
Can somebody help?

Thank you,

Tal




Reply all
Reply to author
Forward
0 new messages