Skip to content

utils

ensure_dir

Create directory if it does not exist.

ensure_file_dir

Create path if it does not exist.

has_file

Check if the given path exists.

pickle_from_file

Load the pickle file from the provided path and returns the object.

pickle_to_file

Save the pickle file to the specified path.

get_device

If CUDA is available, use CUDA device, else use CPU device. When choosing from CUDA devices, this function will choose the one with max memory available.

rand_temp_folder_generator

Create and return a temporary directory with the path name '/temp_dir_name/autokeras' (E:g:- /tmp/autokeras).

download_file

Download the file specified in file_link and saves it in file_path.

download_file_with_extract

Download the file specified in file_link, save to file_path and extract to the directory extract_path.

verbose_print

Print information about the operation performed on father model to obtain current model and father's id.

validate_xy

Validate x_train's type and the shape of x_train, y_train.

read_csv_file

Read the csv file and returns two separate list containing file names and their labels.

Args
  • csv_file_path: Path to the CSV file.
Returns
  • file_names: List containing files names.

  • file_label: List containing their respective labels.

read_image

Read the image contained in the provided path image_path.

compute_image_resize_params

Compute median dimension of all images in data. It used to resize the images later. Number of channels do not change from the original data.

Args
  • data: 1-D, 2-D or 3-D images. The Images are expected to have channel last configuration.
Returns

resize_image_data

Resize images to given dimension.

Args
  • data: 1-D, 2-D or 3-D images. The Images are expected to have channel last configuration.

  • resize_shape: Image resize dimension.

Returns
  • data: Reshaped data.

get_system

Get the current system environment. If the current system is not supported, raise an exception.

Returns