I wanted to get Featurenet-TensorFlow-2 (see Gitlab) running. I did all the steps mentioned there and ran into this error when I wanted to run train.py:
**D:\python\python.exe C:\Users\***\PycharmProjects\featurenet-tensorflow-2\train.py
Epoch 1 of 100
Traceback (most recent call last):
File "C:\Users\***\PycharmProjects\featurenet-tensorflow-2\train.py", line 68, in <module>
for step, (x_batch_train, y_batch_train) in enumerate(train_dataloader):
File "C:\Users\***\PycharmProjects\featurenet-tensorflow-2\utils\dataloader.py", line 10, in dataloader_h5
hf = h5py.File(file_path, 'r')
# ^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python\Lib\site-packages\h5py\_hl\files.py", line 567, in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python\Lib\site-packages\h5py\_hl\files.py", line 231, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 106, in h5py.h5f.open
FileNotFoundError: [Errno 2] Unable to open file (unable to open file: name = 'data_single_feat/train.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
Process finished with exit code 1**
The Code from Dataloader.py looks like this:
import h5py
import tensorflow as tf
import numpy as np
import utils.binvox_rw as binvox_rw
from create_dataset_splits import zero_centering_norm
def dataloader_h5(file_path):
hf = h5py.File(file_path, 'r')
for key in list(hf.keys()):
group = hf.get(key)
x = tf.Variable(np.array(group.get("x"), dtype=np.float32), dtype=tf.float32, name="x")
y = np.array(group.get("y"), dtype=int)
yield x, y
hf.close()
def read_voxel_from_binvox(filepath, normalize=True):
with open(filepath, "rb") as f:
model = binvox_rw.read_as_3d_array(f)
voxel = model.data
if normalize:
voxel = zero_centering_norm(voxel)
filename = filepath.split("/")[-1]
#label = int(filename.split("-")[0])
voxel = tf.Variable(np.array(voxel, dtype=np.float32), dtype=tf.float32, name="x")
#label = np.array(label, dtype=np.int8)
return voxel
So I suppose something with the file path and file name is wrong but I can't figure out what exactly. Thanks for your help.