From d66107175d6a0c0920d72cf91f17922d3758894b Mon Sep 17 00:00:00 2001 From: Anderson Santos Date: Mon, 18 Oct 2021 18:50:21 -0400 Subject: [PATCH] Missing sample when loading csv file When reading a file with the ``read_csv`` method, by default the first line of the file is assumed to contain header information. In the example file mentioned in the tutorial, the first line contains data and if the ``names`` attribute of the ``read_csv`` method is not informed, the first line will be considered as a header. This way, when loading the dataset the first sample will be lost. --- beginner_source/basics/data_tutorial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beginner_source/basics/data_tutorial.py b/beginner_source/basics/data_tutorial.py index 0ef1fb6b777..d12f275c32a 100644 --- a/beginner_source/basics/data_tutorial.py +++ b/beginner_source/basics/data_tutorial.py @@ -160,7 +160,7 @@ def __getitem__(self, idx): def __init__(self, annotations_file, img_dir, transform=None, target_transform=None): - self.img_labels = pd.read_csv(annotations_file) + self.img_labels = pd.read_csv(annotations_file, names=['file_name', 'label']) self.img_dir = img_dir self.transform = transform self.target_transform = target_transform