How to download Aquila Optimizer algorithm using anaconda? - machine-learning

I am trying to download the Aquila optimizer algorithm using anaconda.
Can someone give me the whole instructions?

Related

How to convert pytorch model to TensorRT?

I have trained the classification model on Nvidia GPU and saved the model weights(checkpoint.pth). If I want to deploy this model in jetson nano and test it.
Should I convert it to TenorRT? How to convert it to TensorRT?
I am new to this. It would be helpful if someone can even correct me.
The best way to achieve the way is to export the Onnx model from Pytorch.
Next, use the TensorRT tool, trtexec, which is provided by the official Tensorrt package, to convert the TensorRT model from onnx model.
You can refer to this page: https://github.com/NVIDIA/TensorRT/blob/master/samples/opensource/trtexec/README.md
The TRTEXEC is a more native tool that you can take it from NVIDIA NGC images or downloading from the official website directly.
If you use a tool such as torch2trt, it is easy to encounter the operator issue and complicated to resolve it indeed (if you are not familiar to deal with plugin issues).
You can use this tool:
https://github.com/NVIDIA-AI-IOT/torch2trt
Here are more details how to implent a converter to a engine file:
https://github.com/NVIDIA-AI-IOT/torch2trt/issues/254

Torchscript vs TensorRT for real time inference

I have trained an object detection model to be used in production for real-time applications. I have the following two options. Can anyone suggest what is the best way to run inference on Jetson Xavier for best performance? Any other suggestions are also welcome.
Convert the model to ONXX format and use with TensorRT
Save the model as Torchscript and run inference in C++
On Jetson hardware, my experience is that using TensorRT is definitely faster. You can convert ONNX models to TensorRT using the ONNXParser from NVIDIA. For optimal performance you can choose to use mixed precision. How to convert ONNX to TensorRT is explained here: TensorRT. Section 3.2.5 for python bindings and Section 2.2.5 for the C++ bindings.
I don't have any experience in Jetson Xavier, but in Jetson Nano TensorRT is a little bit faster than ONNX or pytorch. TorchScript does no make any difference from pyTorch.

What is the relationship between PyTorch and Torch?

There are two PyTorch repositories :
https://github.com/hughperkins/pytorch
https://github.com/pytorch/pytorch
The first clearly requires Torch and lua and is a wrapper, but the second doesn't make any reference to the Torch project except with its name.
How is it related to the Lua Torch?
Here a short comparison on pytorch and torch.
Torch:
A Tensor library like numpy, unlike numpy it has strong GPU support.
Lua is a wrapper for Torch (Yes! you need to have a good understanding of Lua), and for that you will need LuaRocks package manager.
PyTorch:
No need for the LuaRocks package manager, no need to write code in Lua. And because we are using Python, we can develop Deep Learning models with utmost flexibility. We can also exploit major Python packages likes scipy, numpy, matplotlib and Cython with PyTorch's own autograd.
There is a detailed discussion on this on pytorch forum. Adding to that both PyTorch and Torch use THNN. Torch provides lua wrappers to the THNN library while Pytorch provides Python wrappers for the same.
PyTorch's recurrent nets, weight sharing and memory usage with the flexibility of interfacing with C, and the current speed of Torch.
For more insights, have a look at this discussion session here.
Just to clarify the confusion between both pytorch repositories:
pytorch/pytorch is very similar to (Lua) Torch but in Python. So it's a wrapper over THNN. This was written by Facebook too.
hughperkins/pytorch: I have come across this repo when I was developing in Torch before pytorch existed, but I have never used it so I'm not quite sure if it is a wrapper written in Python over (Lua) Torch which is in turn a wrapper over THNN OR a wrapper over THNN and Lua. In both case, this is not the original version of Torch. It was written by Hugh Perkins when there was no Python alternative for Torch.
If you are wondering which one to go for, I would definitely recommend pytorch/pytorch as it communicates directly with THNN, is written by the people who made THNN and is continuously maintained. hughperkins/pytorch does not seem to be maintained anymore.

Visualize Neural Net Layers in Torch, without itorch

I have a neural net with several convolution layers and I'd like to visualize the feature maps I'm creating.
I've seen this post:
Visualize images in intermediate layers in torch (lua)
which suggests using itorch, but it requires running my code in an itorch notebook which I would like to avoid.
Are there any other Torch packages which can be used to visualize convolution layers?
EDIT (with detailed solution):
Since I found so few resources online about how to go about doing this I documented my full solution and slapped it on Github. Anyone who wants to visualize neural nets in torch can just go here to get started!
https://github.com/egaebel/torch-neural-network-visualization
Much thanks again to YuTse for the gnuplot tip!
gnuplot
in itorch console mode(itorch) / torch mode(th)
require 'image';
a = image.lena();
require 'gnuplot';
gnuplot.figure(1);
gnuplot.imagesc(a[1])

OpenCV GPU support and TBB

I am going to train my Haar classifier for flowers(which I am highly skeptical about). I have been following the CodingRobin Tut for everything.
http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html
Now, it has been emphasized that I use GPU support, multithreading etc. otherwise the training is gonna take days. I am going to use pre-built libraries and therefore the pre-built opencv_traincascade utility.
I want to ask beforehand, Will I be able to leverage GPU support if I use the pre-built libs, given that I install CUDA?
Where does TBB fit in the whole picture?
Do you recommend me building the whole library from scratch with TBB and CUDA support checked, or that would be a waste?
Note: I am using OpenCV 2.4.11. And I am a complete beginner to OpenCV.

Resources