For example it is written for the CelebA dataset:
torchvision.datasets.CelebA(root, split='train', download=False)
While for CIFAR there is writing:
torchvision.datasets.CIFAR10(root, train=True, download=False)
My question is: what is the difference between train=true and split=train?
If you refer to link it depends according to the dataset you're using.
For instance for the CIFAR dataset you have no parameterssplit in the docs, whereas CELEBA has no train parameters.
This is a choice made by the ones that wrote the library and as you can read in the docs there is no norms about those parameters, it really depends on the dataset you want to use.
Related
I asked this question to better understand some of the nuances between training Spacy models with DocBins serialized to disk, versus loading Example instances via custom data loading function. The goal was to train a Spacy NER model with more data that can fit into RAM (or at least some way to avoid loading the entire file into RAM). Though the custom data loader seemed like one specific way to accomplish this, I am writing this question to ask more generally:
How can one train a Spacy model without loading the entire training data set file during training?
Your only options are using a custom data loader or setting max_epochs = -1. See the docs.
I am studying the tutorial on GANs by Google. In this notebook they have defined input_fn in which MNIST dataset is loaded using tfds. I have generated my own dataset and have stored that in numpy array(shape : 4500, 512, 512).
I can't understand how input_fn works and how I can modify it so that I can input training data from my gdrive rather than downloading from tf datasets. I have noticed that input_fn is also used while training when gan_estimator.train is called. Can anyone explain how this function works?
The function input_fn uses TensorFlow datasets in the following line to load MNIST.
tfds.load('mnist', split=split)
.map(_preprocess)
.cache()
.repeat()
You need to understand how TensorFlow datasets work to make one your own following the required structure to be processed.
You can get more information here.
According to the comment at the top of the TextCategorizer,
Train a convolutional neural network text classifier on the IMDB
dataset, using the TextCategorizer component. The dataset will be
loaded automatically via Thinc's built-in dataset loader. The model is
added to spacy.pipeline, and predictions are available via doc.cats.
For more details, see the documentation:
* Training: https://spacy.io/usage/training
Where is the code for the CNN? Can the CNN be configured? Is there a research paper the implementation is based on?
The network architecture is defined in the _.ml module specifically within the build_text_classifier function.
The code related with the training is within the pipeline module specifically within the TextCategorizer class.
Some parameters like drop_out, batch_size and the number of epochs can be configured as showed in the example, you can also modify the architecture of the network but for that you have to know about the framework behind spaCy which is called Thinc https://github.com/explosion/thinc and some Cython.
I don't know about any paper describing the model but this video provide a great description of it https://www.youtube.com/watch?v=sqDHBH9IjRU
I'm trying to follow the approach of feeding training data thru sequence examples as described in the link
https://www.tensorflow.org/programmers_guide/reading_data for training an LSTM based RNN model via input pipelines and queues. since these examples are symbolic references, I'm unclear how we can feed a single or batch of test inputs on a trained model. A similar query was asked on the forum (Sample from tensorflow LSTM model when using symbolic batch inputs) but the solution is unclear. any suggestions here
after some search this is the best i could get from the link https://github.com/dennybritz/tf-rnn/issues/3
Different ways to do this:
1) Create a different graph for training/inference (this is typically recommended) with different tensors as inputs.
2) Use tf.contrib.learn.Estimator and it's input function
3) Something like sess.run([train_op], feed_dict={batched_data: YOUR_CUSTOM_DATA}) should work
I want to extract features using caffe and train those features using SVM. I have gone through this link: http://caffe.berkeleyvision.org/gathered/examples/feature_extraction.html. This links provides how we can extract features using caffenet. But I want to use Lenet architecture here. I am unable to change this line of command for Lenet:
./build/tools/extract_features.bin models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel examples/_temp/imagenet_val.prototxt fc7 examples/_temp/features 10 leveldb
And also, after extracting the features, how to train these features using SVM? I want to use python for this. For eg: If I get features from this code:
features = net.blobs['pool2'].data.copy()
Then, how can I train these features using SVM by defining my own classes?
You have two questions here:
Extracting features using LeNet
Training an SVM
Extracting features using LeNet
To extract the features from LeNet using the extract_features.bin script you need to have the model file (.caffemodel) and the model definition for testing (.prototxt).
The signature of extract_features.bin is here:
Usage: extract_features pretrained_net_param feature_extraction_proto_file extract_feature_blob_name1[,name2,...] save_feature_dataset_name1[,name2,...] num_mini_batches db_type [CPU/GPU] [DEVICE_ID=0]
So if you take as an example val prototxt file this one (https://github.com/BVLC/caffe/blob/master/models/bvlc_alexnet/train_val.prototxt), you can change it to the LeNet architecture and point it to your LMDB / LevelDB. That should get you most of the way there. Once you did that and get stuck, you can re-update your question or post a comment here so we can help.
Training SVM on top of features
I highly recommend using Python's scikit-learn for training an SVM from the features. It is super easy to get started, including reading in features saved from Caffe's format.
Very lagged reply, but should help.
Not 100% what you want, but I have used the VGG-16 net to extract face features using caffe and perform a accuracy test on a small subset of the LFW dataset. Exactly what you needed is in the code. The code creates classes for training and testing and pushes them into the SVM for classification.
https://github.com/wajihullahbaig/VGGFaceMatching