diff --git a/docs/tutorials/convolutional_neural_network_for_image_classification.ipynb b/docs/tutorials/convolutional_neural_network_for_image_classification.ipynb index ee15eaa03..d7035bb84 100644 --- a/docs/tutorials/convolutional_neural_network_for_image_classification.ipynb +++ b/docs/tutorials/convolutional_neural_network_for_image_classification.ipynb @@ -47,7 +47,6 @@ }, { "cell_type": "code", - "execution_count": null, "id": "initial_id", "metadata": { "collapsed": true @@ -57,7 +56,8 @@ "\n", "images, filepaths = ImageList.from_files(\"data/shapes\", return_filenames=True)" ], - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -84,8 +84,8 @@ "collapsed": false }, "id": "66dcf95a3fa51f23", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -108,8 +108,8 @@ "collapsed": false }, "id": "32056ddf5396e070", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -149,8 +149,8 @@ "collapsed": false }, "id": "806a8091249d533a", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -175,8 +175,8 @@ "collapsed": false }, "id": "af68cc0d32655d32", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -198,15 +198,13 @@ }, { "cell_type": "code", - "source": [ - "cnn_fitted = cnn.fit(dataset, epoch_size=32, batch_size=16)" - ], + "source": "cnn_fitted = cnn.fit(dataset, epoch_size=8, batch_size=16)", "metadata": { "collapsed": false }, "id": "381627a94d500675", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -227,8 +225,8 @@ "collapsed": false }, "id": "62f63dd68362c8b7", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -249,8 +247,8 @@ "collapsed": false }, "id": "779277d73e30554d", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -271,8 +269,8 @@ "collapsed": false }, "id": "a5ddbbfba41aa7f", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null }, { "cell_type": "markdown", @@ -293,8 +291,8 @@ "collapsed": false }, "id": "7081595d7100fb42", - "execution_count": null, - "outputs": [] + "outputs": [], + "execution_count": null } ], "metadata": { diff --git a/src/safeds/data/labeled/containers/_image_dataset.py b/src/safeds/data/labeled/containers/_image_dataset.py index c852c11a8..a64bff83a 100644 --- a/src/safeds/data/labeled/containers/_image_dataset.py +++ b/src/safeds/data/labeled/containers/_image_dataset.py @@ -356,6 +356,8 @@ def split( upper_bound=_ClosedBound(1), ) + _init_default_device() + first_dataset: ImageDataset[Out_co] = copy.copy(self) second_dataset: ImageDataset[Out_co] = copy.copy(self) diff --git a/src/safeds/ml/nn/converters/_input_converter_image_to_column.py b/src/safeds/ml/nn/converters/_input_converter_image_to_column.py index da03c03a0..1d58286b5 100644 --- a/src/safeds/ml/nn/converters/_input_converter_image_to_column.py +++ b/src/safeds/ml/nn/converters/_input_converter_image_to_column.py @@ -6,7 +6,6 @@ from safeds.data.image.containers._single_size_image_list import _SingleSizeImageList from safeds.data.labeled.containers import ImageDataset from safeds.data.labeled.containers._image_dataset import _ColumnAsTensor -from safeds.data.tabular.containers import Column from ._input_converter_image import _InputConversionImage @@ -14,6 +13,7 @@ from torch import Tensor from safeds.data.image.containers import ImageList + from safeds.data.tabular.containers import Column from safeds.data.tabular.transformation import OneHotEncoder @@ -43,9 +43,9 @@ def _data_conversion_output( output = torch.zeros(len(input_data), len(one_hot_encoder._get_names_of_added_columns())) output[torch.arange(len(input_data)), output_data] = 1 - im_dataset: ImageDataset[Column] = ImageDataset[Column].__new__(ImageDataset) + im_dataset: ImageDataset[Column] = object.__new__(ImageDataset) im_dataset._output = _ColumnAsTensor._from_tensor(output, column_name, one_hot_encoder) - im_dataset._shuffle_tensor_indices = torch.LongTensor(list(range(len(input_data)))) + im_dataset._shuffle_tensor_indices = torch.arange(len(input_data)) im_dataset._shuffle_after_epoch = False im_dataset._batch_size = 1 im_dataset._next_batch_index = 0 diff --git a/src/safeds/ml/nn/converters/_input_converter_image_to_table.py b/src/safeds/ml/nn/converters/_input_converter_image_to_table.py index fe5ce6ad4..2fe33d0c7 100644 --- a/src/safeds/ml/nn/converters/_input_converter_image_to_table.py +++ b/src/safeds/ml/nn/converters/_input_converter_image_to_table.py @@ -6,7 +6,6 @@ from safeds.data.image.containers._single_size_image_list import _SingleSizeImageList from safeds.data.labeled.containers import ImageDataset from safeds.data.labeled.containers._image_dataset import _TableAsTensor -from safeds.data.tabular.containers import Table from ._input_converter_image import _InputConversionImage @@ -14,6 +13,7 @@ from torch import Tensor from safeds.data.image.containers import ImageList + from safeds.data.tabular.containers import Table class InputConversionImageToTable(_InputConversionImage): @@ -33,9 +33,9 @@ def _data_conversion_output(self, input_data: ImageList, output_data: Tensor) -> output = torch.zeros(len(input_data), len(column_names)) output[torch.arange(len(input_data)), output_data] = 1 - im_dataset: ImageDataset[Table] = ImageDataset[Table].__new__(ImageDataset) + im_dataset: ImageDataset[Table] = object.__new__(ImageDataset) im_dataset._output = _TableAsTensor._from_tensor(output, column_names) - im_dataset._shuffle_tensor_indices = torch.LongTensor(list(range(len(input_data)))) + im_dataset._shuffle_tensor_indices = torch.arange(len(input_data)) im_dataset._shuffle_after_epoch = False im_dataset._batch_size = 1 im_dataset._next_batch_index = 0 diff --git a/src/src/resources/to_csv_file.csv b/src/src/resources/to_csv_file.csv deleted file mode 100644 index 3390b52f8..000000000 --- a/src/src/resources/to_csv_file.csv +++ /dev/null @@ -1,4 +0,0 @@ -a,b -1,4 -2,5 -3,6 diff --git a/src/src/resources/to_json_file.json b/src/src/resources/to_json_file.json deleted file mode 100644 index 73915956e..000000000 --- a/src/src/resources/to_json_file.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - { "a": 1, "b": 4 }, - { "a": 2, "b": 5 }, - { "a": 3, "b": 6 } -] diff --git a/src/src/resources/to_parquet_file.parquet b/src/src/resources/to_parquet_file.parquet deleted file mode 100644 index 8e2bdf914..000000000 Binary files a/src/src/resources/to_parquet_file.parquet and /dev/null differ