Currently, I am learning CNN by myself. I find lots of sources on the Internet. But most of them use Pytorch and Tensorflow. I want to find some examples for image classification that uses NumPy only and have some way to train my dataset, save and load the trained model. Does anyone know where is the example?
I wrote a library if you are interested: https://github.com/samrere/pytortto
basically it's a pytorch written in numpy&cupy. It completely follows pytorch interface, and can be trained in GPU.
I've included several basic examples, such as training Resnet, UNet, vision transformer and DCGAN, all trained/finetuned entirely using simple numpy functions.
Related
I have a real-time problem which is aimed to detect 9 objects. As far as I understand, yolo has promising results on real-time object detection problems so I am searching good instructions to train a pre-trained yolo model with my custom "own" dataset.
I have my dataset and they are already labeled, also they have bounding box coordinates in .txt files in yolo format. However, it is a bit confusing to find a good instruction on the web about yolo custom dataset training for own object detection problem, since instructions are mostly using generic dataset such as COCO, PASCAL etc. or their instructions are not well enough to implement the object detection model on own dataset.
TL;DR
My question is, are there some handy instructions about implementing yolo object detection for own dataset? I am more looking for frameworks to implement yolo model rather than darknet C implementation since I am more familiar with python so it would be perfect if you could provide Pytorch or Tensorflow implementation.
It is more appraciated if you already implemented yolov3-v4 with your own dataset with the help of instructions you found on the web and you are willing to share those instructions.
Thanks in advance.
For training purpose I would highly recommend AlexeyAB's repository as it's highly optimised for accuracy and speed, although it is also written in C. As far as testing and deployment is considered you have a lot of options:
OpenCV's DNN Module: refer this article.
Tensorflow Model
Pytorch Model
Out of these OpenCV's DNN implementation is the fastest for testing/inference.
I have Data A from accelerometer and gyroscope sensors like this
I want to create a pre-trained model to be used to classify with the LSTM method using Data A in python. Is that possible? Because from what I read, pre-trained is used for image data and uses methods such as CNN for classification. In addition, I tried to find data that has gone through the pre-trained process but have not found it so I doubt whether it is possible.
And if I do the classification using LSTM, can I use the A data that has gone through the pre-trained?
Is there a tutorial I can study? Any help would be very much appreciated.
I advise you to look at some HAR datasets you can find plenty of examples in Kaggle that are using a LSTM, the first one that comes to my mind is the excellent tutorial of Jason Brownlee https://machinelearningmastery.com/how-to-develop-rnn-models-for-human-activity-recognition-time-series-classification/
I have an image classification problem where the number of classes increases over time and when a new class is created I just trained the model with images of the new class. I know this is not possible to do with a CNN, so to solve this problem I did transfer learning where I used a Keras pretrained model to extract the features of the images but instead of replacing the last layers (used for classification) with new layers, I used a Random Forest that is able to increase the number of classes. I achieved an accuracy of 86% using the InceptionResnetV2 trained on the imagenet dataset, which is good for now.
Now I want to do the same but on an object detection problem. How can I achieve this? Can I use the Tensorflow Object Detection API?
Is it possible to replace the last layers, of a pretrained CNN with a detection algorithm like Faster-RCNN or SSD, with a random forest?
Yes, you could implement the above-mentioned approach using Tensorflow object detection API. Also, you could use your InceptionResnetV2 trained model as a feature extractor. The tensorflow object detection API already has InceptionResnetV2 feature extractor trained on coco dataset. Its available at https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
Or if you want to provide or create custom feature extractor, please follow the link https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/defining_your_own_model.md
If you are new to Tensorflow object detection API. Please follow this tutorial,
https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10
Hope this helps.
I have a 2-class classification problem in hand. I have extracted a set of 3 features for each training example .. I am planning to use a very simple CNN to learn the weights. My model looks like
I am planning to use tensorflow for implementing this CNN in python. The official tutorial https://www.tensorflow.org/tutorials/deep_cnn/ seems to be somewhat abstract . Can I get a basic code to train this?
You seem to be missing the point of CNN, which require signal with spatial relations (such as raw images, audio, etc.). Convolving signal with three features makes pretty much no sense (pretty much the only option would be a 2x1 filter convolving among the only axis, leading to nearly regular MLP). What you are looking for is rather basic classifier, and in general - neural nets are probably not the good choice (they are not good models for small, low-dimensional problems), you should be fine with models like kernelized SVM, and other classifiers which are available in scikit-learn. For basic TF code look at its basic tutorial, since as said before - this is not a problem for CNN. Furthermore, TF is not a simple library which trains a model in few lines of code, if you are looking for this kind of things you should rather take a look at keras, tf-slim or other libraries built on top of TF.
I am new to Machine Learning and recently took a courser by Andrew Ng on Coursera.
After that I shifted to Python and used Pandas, Numpy, Sklearn to implement ML algorithms.
Now while surfing I came across tensorFLow and found it pretty amazing, and implemented this example which takes MNIST data as input.
Now I want to read my own custom images and use them for training. I am confused as to how should I convert the images to MNIST sort of data. Or some other way to train my Network.
I took this tutorial to create my network.
Information on the MNIST dataset can be found on Yann LeCun's website.
The TensorFlow module tensorflow.examples.tutorials.mnist.mnist_softmax.py looks to be acquiring/preparing the dataset for the train/test steps.
The MNIST dataset contains an image of a handwritten digit and a corresponding label. If you would like to create labels for a new image, you could use scipy.misc.imread.