satojkovic / DeepLogo

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

feedback #2

Open gopi77 opened 7 years ago

gopi77 commented 7 years ago

Hi Thanks for the code. I trained and tested it, but the outputs are not matching, please check.

gopi@gp:~/tensorflow/tensorflow/logo/DeepLogo-master$ python test_deep_logo_cnn.py I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so.5.1.5 locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so.8.0 locally ('Test image:', 'flickr_logos_27_dataset/flickr_logos_27_dataset_cropped_augmented_images/Citroen/test/3577850173_Citroen_5_80_r-14.jpg') I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero I tensorflow/core/common_runtime/gpu/gpu_device.cc:951] Found device 0 with properties: name: GeForce GTX 1070 major: 6 minor: 1 memoryClockRate (GHz) 1.835 pciBusID 0000:01:00.0 Total memory: 7.92GiB Free memory: 7.29GiB I tensorflow/core/common_runtime/gpu/gpu_device.cc:972] DMA: 0 I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] 0: Y I tensorflow/core/common_runtime/gpu/gpu_device.cc:1041] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1070, pci bus id: 0000:01:00.0) Model restored ('Class name:', 'Nbc')

satojkovic commented 7 years ago

@gopi77 Unfortunately, the trained model sometimes returns wrong, incorrect results. Please try to run the test script several times.

$ python test_deep_logo_cnn.py 
Test image: flickr_logos_27_dataset/flickr_logos_27_dataset_cropped_augmented_images/Texaco/test/3907307172_Texaco_2_2_r-3.jpg
Model restored
Class name: Texaco
Probability: 1.0
$ python test_deep_logo_cnn.py 
Test image: flickr_logos_27_dataset/flickr_logos_27_dataset_cropped_augmented_images/Porsche/test/4213412628_Porsche_5_3_p-20.jpg
Model restored
Class name: Porsche
Probability: 1.0
$ python test_deep_logo_cnn.py 
Test image: flickr_logos_27_dataset/flickr_logos_27_dataset_cropped_augmented_images/Nbc/test/557839607_Nbc_4_2_p01.jpg
Model restored
Class name: Nbc
Probability: 1.0
$ python test_deep_logo_cnn.py 
Test image: flickr_logos_27_dataset/flickr_logos_27_dataset_cropped_augmented_images/RedBull/test/4559666515_RedBull_2_4_p10.jpg
Model restored
Class name: RedBull
Probability: 1.0
chuang0310 commented 7 years ago

Hi I also find that the output is wrong. I try about ten times, unfortunately, they are all wrong.

gopi77 commented 7 years ago

I extended the fully connected layers to 4

  1. 8192 to 2048
  2. 2048 to 512
  3. 512 to 128
  4. 128 to 27 (No of logos)

Also changed the standard deviation computation to 1/No. of input tensors (the hard coding of 0.1 is not used)

Now the trained results are good but the test code still shows wrong output, i suspect issue with test code, debugging now.

On Tue, Oct 11, 2016 at 3:40 PM, Billie notifications@github.com wrote:

Hi I also find that the output is wrong. I try about ten times, unfortunately, they are all wrong.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/satojkovic/DeepLogo/issues/2#issuecomment-252868318, or mute the thread https://github.com/notifications/unsubscribe-auth/AMDeKFHLWMV5tfrqi9C813PLTRmTpkZuks5qy2CIgaJpZM4KJ31y .

frey123 commented 7 years ago

Are there any news? i run into the same issue. The test result of test_deep_logo_cnn.py ist wrong. Validation accuracy is good >85%.

Best regards

mursalal commented 7 years ago

same: all wrong

python test_deep_logo_cnn.py ('Test image:', 'flickr_logos_27_dataset/flickr_logos_27_dataset_cropped_augmented_images/Nbc/train/2518709496_Nbc_2_1_r-8.jpg') W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. initialized ('Class name:', 'McDonalds') ('Probability:', 1.0)

satojkovic commented 7 years ago

@frey123 @mursalal

What version of tensorflow are you using? Please update tensorflow to 0.12 or higher, then could you try new master ? 8625d80d9c16b0137c7c0874e9be4f107bc41f6d

frey123 commented 7 years ago

I pulled to new master. Unfortunately nothing changed for me.

Tensorflow version: 1.0.1 Numpy version: 1.12.0 cPickle version: 1.71 scipy version: 0.19.0

Training output:

Minibatch loss at step 9950: 0.104961 Minibatch accuracy: 100.0% Validation accuracy: 94.0% Minibatch loss at step 10000: 0.125578 Minibatch accuracy: 100.0% Validation accuracy: 93.0% Test accuracy: 92.0% Model saved in file: models/deep_logo_model

Testing Output:

python test_deep_logo_cnn.py I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally ('Test image:', 'flickr_logos_27_dataset/flickr_logos_27_dataset_cropped_augmented_images/Puma/train/3164722529_Puma_6_4_p10.jpg') W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: name: GeForce GTX 1060 major: 6 minor: 1 memoryClockRate (GHz) 1.6705 pciBusID 0000:01:00.0 Total memory: 5.93GiB Free memory: 5.87GiB I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0) Model restored ('Class name:', 'Google') ('Probability:', 1.0)

satojkovic commented 7 years ago

@frey123

The model might learns too well the details and the noise from training data(i.e. overfitting). To prevent overfitting, more training data is needed. For example, could you try the following?

diff --git a/crop_and_aug.py b/crop_and_aug.py
index e7e3502..ebcbeda 100644
--- a/crop_and_aug.py
+++ b/crop_and_aug.py
@@ -35,8 +35,8 @@ import glob
 CNN_IN_WIDTH = 64
 CNN_IN_HEIGHT = 32

-DATA_AUG_POS_SHIFT_MIN = -2
-DATA_AUG_POS_SHIFT_MAX = 2
+DATA_AUG_POS_SHIFT_MIN = -5
+DATA_AUG_POS_SHIFT_MAX = 5
 DATA_AUG_SCALES = [0.9, 1.1]
 DATA_AUG_ROT_MIN = -15
 DATA_AUG_ROT_MAX = 15
frey123 commented 7 years ago

@satojkovic

test_deep_logo_cnn.py works good for the testing data. But when i try to classify data from the wild it outputs wrong results.

https://www.career.aero/files/i/employer/dhl-1057/dhl_star_01.jpg Says: ('Class name:', 'Adidas') ('Probability:', 1.0)

http://image.gala.de/21346674/3x2-940-627/e5b8f89089d7fae1e4e2c6f878bc0f53/bL/dhl.jpg Says: ('Class name:', 'Google') ('Probability:', 0.99995375)

best regards Frey

sullix commented 7 years ago

@frey123 Hi. I have the same results... they are very bad (almost 0% of success) on different pictures representing the logos in the dataset but with other sources, and resized (64x32).

frey123 commented 7 years ago

My next step is to try with Inception v3 pretrained on the imagenet. Maybe the number plate network isnt good for real world images. What do you mean @satojkovic ?

I dont get how it can output 100% confidence for a class like 'Adidas' in a real world image with a DHL logo in it. Update: For the same image it outputs a different class every time with 100% confidence (nondeterministic!). Or is the sliding window missing like in the blog post?

satojkovic commented 7 years ago

@frey123

Yeah, right. At the moment, It is difficult to classify those images correctly because the model is trained on cropped images. In order to detect logos in real world images, I think it is good to use sliding window approach instead of using other network architecture.

frey123 commented 7 years ago

but when it outputs 100% now, how does it will perform good with sliding window approach? I will try it with some cropped regions in the real world image if a background (no-logo) will result in high probabilities as well as the entire image.

munibasad commented 7 years ago

@frey123 @satojkovic
I am getting good results with default test folders. (randomly selects test folder and randomly selects an image) but when I restrict the model to select one test folder or one image, it gives wrong answers. For example, when I restrict it to Adidas search folder and make it select a Cocacola image, it shows the output to be Adidas. also if i try to test the trained model with a wild image from net, it gives wrong output. Any idea why?

frey123 commented 7 years ago

@satojkovic I tried a sliding window with a image pyramid approach. But it gives me a probability of 1.0 on every window for random classes. See screenshot:

Sliding window

I played a lot with the window and pyramid scale factors but unfortunately always 1.0 on all predictions. This can be right.

cryax commented 7 years ago

Hi @gopi77 @satojkovic @frey123 I think there's some mismatch between train and test script. Try create test image via train process. The result is quite accurate for me on new test data (wild images).

satojkovic commented 7 years ago

@cryax

Thank you for your comment. I'm trying to build the model to detect logos in the wild images, but I can't yet. So, Could you tell me about your techniques about training? How do you create train images?

cryax commented 7 years ago

@satojkovic As I said, you should try creating test image (load image then scale) by training process. I think there's somethings wrong with your test script when you load image.

satojkovic commented 6 years ago

@frey123

I have implemented region-based cnn so as to detect logos in an image. When I try to detect logos in your image, I can get the results successfully.(see below image)

Could you try new master? (change pred_prob_th=0.999 at line no 130 in detect_logo.py)

test_dhl

sarwojowo commented 6 years ago

i try this failed when test to detect