Video-Classification-2-Stream-CNN icon indicating copy to clipboard operation
Video-Classification-2-Stream-CNN copied to clipboard

How do we run the test dataset in the temporal ConvNet?

Open ghost opened this issue 7 years ago • 6 comments

for chunk in chunks(keys,chunk_size): if flag<1: print("Preparing testing data...") X_test,Y_test=getTrainData(chunk,nb_classes,img_rows,img_cols) flag+=1 continue print instance_count instance_count+=chunk_size X_batch,Y_batch=getTrainData(chunk,nb_classes,img_rows,img_cols) if (X_batch!=None and Y_batch!=None): loss = model.fit(X_batch, Y_batch, verbose=1, batch_size=batch_size, nb_epoch=1, show_accuracy=True) if instance_count%256==0: loss = model.evaluate(X_test,Y_test,batch_size=batch_size,verbose=1) preds = model.predict(X_test) print (preds) print ('-'*40) print (Y_test) comparisons=[] maximum=np.argmax(Y_test,axis=1) for i,j in enumerate(maximum): comparisons.append(preds[i][j]) with open('compare.txt','a') as f1: f1.write(str(comparisons)) f1.write('\n\n') with open('loss.txt','a') as f1: f1.write(str(loss)) f1.write('\n') model.save_weights('temporal_stream_model.h5',overwrite=True)

So is the code which running the testing part of the code ?

ghost avatar May 01 '17 13:05 ghost

yes, training and testing after some(predefined) epochs.

wadhwasahil avatar May 02 '17 05:05 wadhwasahil

Using TensorFlow backend. Loading dictionary... Preparing architecture... /home/user/PycharmProjects/Video-Classification-2-Stream-CNN-master/temporal/temporal_stream_cnn.py:54: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(48, (7, 7), padding="same", input_shape=(20, 150, ...) model.add(Convolution2D(48, 7, 7, border_mode='same',input_shape=(img_channels, img_rows, img_cols))) /home/user/PycharmProjects/Video-Classification-2-Stream-CNN-master/temporal/temporal_stream_cnn.py:59: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(96, (5, 5), padding="same") model.add(Convolution2D(96, 5, 5, border_mode='same')) /home/user/PycharmProjects/Video-Classification-2-Stream-CNN-master/temporal/temporal_stream_cnn.py:64: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(256, (3, 3), padding="same") model.add(Convolution2D(256, 3, 3, border_mode='same')) /home/user/PycharmProjects/Video-Classification-2-Stream-CNN-master/temporal/temporal_stream_cnn.py:68: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), padding="same") model.add(Convolution2D(512, 3, 3, border_mode='same')) /home/user/PycharmProjects/Video-Classification-2-Stream-CNN-master/temporal/temporal_stream_cnn.py:72: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(512, (3, 3), padding="same") model.add(Convolution2D(512, 3, 3, border_mode='same')) Compiling model...

('Epoch', 0)

Preparing testing data... 0 64 128 192 256 320 384

so is this the testing part or this is just collection of testing data

ghost avatar May 03 '17 03:05 ghost

Yes this is the test data been prepared. It is just the number of videos processed/prepared for testing AFAIK.

wadhwasahil avatar May 03 '17 05:05 wadhwasahil

So when will it start predicting the action in the video , since I can't find the part within the code which will actually classify test video into anyone of 20 categories.

On Wed, 3 May 2017 at 10:45 AM, Sahil Wadhwa [email protected] wrote:

Yes this is the test data been prepared. It is just the number of videos processed/prepared for testing AFAIK.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/wadhwasahil/Video-Classification-2-Stream-CNN/issues/11#issuecomment-298824713, or mute the thread https://github.com/notifications/unsubscribe-auth/Aa82FJUhtswRkXYuCyxMu1AkQ2np9_V9ks5r2A1pgaJpZM4NNCQK .

ghost avatar May 03 '17 05:05 ghost

preds = model.predict(X_test) does the predictions of test videos.

wadhwasahil avatar May 03 '17 05:05 wadhwasahil

model.add(Convolution2D(512, 3, 3, border_mode='same')) Compiling model...

('Epoch', 0)

Preparing testing data... 0 64 128 192 256 320 384 ...... ('epoch',20) ..... . ... 178048 178112 178176 178240 178304 178368 178432 178496 178560 178624 178688 178752

Process finished with exit code 0

so that is it this is showing where do I recieve the final prediced classes and stuff since it is not shown in the out

ghost avatar May 04 '17 04:05 ghost