satojkovic / DeepLogo

A brand logo detection system using tensorflow object detection API.
MIT License
512 stars 157 forks source link

Unable to process data from flickr_logos_27_dataset\flickr_logos_27_dataset_cropped_augmented_images\Adidas\train.pickle : could not broadcast input array from shape (4412,32,64,3) into shape (35000,32,64,3) #23

Open rmirzojonov opened 6 years ago

rmirzojonov commented 6 years ago

Hello, I am new to tensorflow so I tried to reduce the number of logos to only one (Adidas) to make it run faster. Removed everything except Adidas data from flickr_logos_27_dataset_query_set_annotation.txt and flickr_logos_27_dataset_training_set_annotation.txt. Edited common.py:

CLASS_NAME = [
    'Adidas', 'Background'
]

train and test folders are created for both Adidas and Background. So when I try to run gen_train_valid_test.py, it shows and error:

Unable to process data from flickr_logos_27_dataset\flickr_logos_27_dataset_cropped_augmented_images\Adidas\train.pickle : could not broadcast input array from shape (4412,32,64,3) into shape (35000,32,64,3) Traceback (most recent call last): File "c:\Users\username\Documents\Workspace\DeepLogo\gen_train_valid_test.py", line 196, in main() File "c:\Users\username\Documents\Workspace\DeepLogo\gen_train_valid_test.py", line 182, in main train_datasets, TRAIN_SIZE, VALID_SIZE) File "c:\Users\username\Documents\Workspace\DeepLogo\gen_train_valid_test.py", line 132, in merge_datasets train_dataset[start_t:end_t, :, :, :] = train_logo ValueError: could not broadcast input array from shape (4412,32,64,3) into shape (35000,32,64,3)

Can you help me solving this issue. Thanks!

bruce-willis commented 6 years ago

Hello @rmirzojonov! Unfortunately, nowadays you can not

Removed everything except Adidas data from flickr_logos_27_dataset_query_set_annotation.txt and flickr_logos_27_dataset_training_set_annotation.txt. Edited common.py:

So, to fix that you have to generate background, crop and aug for all classes :(

bruce-willis commented 6 years ago

@rmirzojonov Size of train and valid dataset are calculated at line 114 gen_train_valid_test.py

vsize_per_class = valid_size // num_classes
tsize_per_class = train_size // num_classes

The size depends on number of classes: less classes you have - bigger vsize per class you get. I don't think it is a good idea to have such dependency. And if you have only 1 class — vsize will be bigger than size of your class

juules87 commented 5 years ago

Could you please explain how to adjust the model when estimating the model only for one logo without including all logo's?

Thanks in advance

fdornelasx commented 5 years ago

I am actually having the same problem. I have 5 classes and getting the same problem. What could I do to solve this?

Here my command line error: Unable to process data from tv_logos_dataset/tv_logos_dataset_cropped_augmented_images/Globo/train.pickle : could not broadcast input array from shape (27,32,64,3) into shape (1250,32,64,3) Traceback (most recent call last): File "gen_train_valid_test.py", line 196, in <module> main() File "gen_train_valid_test.py", line 182, in main train_datasets, TRAIN_SIZE, VALID_SIZE) File "gen_train_valid_test.py", line 127, in merge_datasets valid_dataset[start_v:end_v, :, :, :] = valid_logo ValueError: could not broadcast input array from shape (27,32,64,3) into shape (1250,32,64,3)

I'm trying just for test with 1 image for each class.