Computer Vision News - August 2022

12 CNN+LSTM Neural Networks dset[row_count:] = chunk[0] dset2[row_count:] = chunk[1] # Increment the row count row_count += chunk[0].shape[0] row_count2 += chunk[1].shape[0] print_progress(numer, n_files) numer += 1 def make_files_test(n_files): gen = proces_transfer(names_test, in_dir, labels_test) numer = 1 # Read the first chunk to get the column dtypes chunk = next(gen) row_count = chunk[0].shape[0] row_count2 = chunk[1].shape[0] with h5py.File('pruebavalidation.h5', 'w') as f: # Initialize a resizable dataset to hold the output maxshape = (None,) + chunk[0].shape[1:] maxshape2 = (None,) + chunk[1].shape[1:] dset = f.create_dataset('data', shape=chunk[0].shape, maxshape=maxshape, chunks=chunk[0].shape, dtype=chunk[0].dtype) dset2 = f.create_dataset('labels', shape=chunk[1].shape, maxshape=maxshape2, chunks=chunk[1].shape, dtype=chunk[1].dtype) # Write the first chunk of rows dset[:] = chunk[0] dset2[:] = chunk[1] for chunk in gen: if numer == n_files: break # Resize the dataset to accommodate the next chunk of rows dset.resize(row_count + chunk[0].shape[0], axis=0) dset2.resize(row_count2 + chunk[1].shape[0], axis=0) # Write the next chunk dset[row_count:] = chunk[0] dset2[row_count:] = chunk[1] # Increment the row count row_count += chunk[0].shape[0] row_count2 += chunk[1].shape[0] print_progress(numer, n_files) numer += 1

RkJQdWJsaXNoZXIy NTc3NzU=