diff --git a/YOLOv5-3.X.md b/YOLOv5-3.X.md
new file mode 100644
index 0000000..92ea64b
--- /dev/null
+++ b/YOLOv5-3.X.md
@@ -0,0 +1,191 @@
+# YOLOv5
+NVIDIA DeepStream SDK 5.1 configuration for YOLOv5 3.0/3.1 models
+
+Thanks [DanaHan](https://github.com/DanaHan/Yolov5-in-Deepstream-5.0), [wang-xinyu](https://github.com/wang-xinyu/tensorrtx) and [Ultralytics](https://github.com/ultralytics/yolov5)
+
+##
+
+* [Requirements](#requirements)
+* [Convert PyTorch model to wts file](#convert-pytorch-model-to-wts-file)
+* [Convert wts file to TensorRT model](#convert-wts-file-to-tensorrt-model)
+* [Compile nvdsinfer_custom_impl_Yolo](#compile-nvdsinfer_custom_impl_yolo)
+* [Testing model](#testing-model)
+
+##
+
+### Requirements
+* [TensorRTX](https://github.com/wang-xinyu/tensorrtx/blob/master/tutorials/install.md)
+
+* [Ultralytics](https://github.com/ultralytics/yolov5/blob/v3.1/requirements.txt)
+
+* Matplotlib (for Jetson plataform)
+```
+sudo apt-get install python3-matplotlib
+```
+
+* PyTorch (for Jetson plataform)
+```
+wget https://nvidia.box.com/shared/static/9eptse6jyly1ggt9axbja2yrmj6pbarc.whl -O torch-1.6.0-cp36-cp36m-linux_aarch64.whl
+sudo apt-get install python3-pip libopenblas-base libopenmpi-dev
+pip3 install torch-1.6.0-cp36-cp36m-linux_aarch64.whl
+```
+
+* TorchVision (for Jetson platform)
+```
+git clone -b v0.7.0 https://github.com/pytorch/vision torchvision
+sudo apt-get install libjpeg-dev zlib1g-dev python3-pip
+cd torchvision
+export BUILD_VERSION=0.7.0
+sudo python3 setup.py install
+```
+
+##
+
+### Convert PyTorch model to wts file
+1. Download repositories
+```
+git clone https://github.com/DanaHan/Yolov5-in-Deepstream-5.0.git yolov5converter
+git clone -b yolov5-v3.1 https://github.com/wang-xinyu/tensorrtx.git
+git clone -b v3.1 https://github.com/ultralytics/yolov5.git
+```
+
+2. Download latest YoloV5 (YOLOv5s, YOLOv5m, YOLOv5l or YOLOv5x) weights to yolov5/weights directory (example for YOLOv5s)
+```
+wget https://github.com/ultralytics/yolov5/releases/download/v3.1/yolov5s.pt -P yolov5/weights/
+```
+
+3. Copy gen_wts.py file (from tensorrtx/yolov5 folder) to yolov5 (ultralytics) folder
+```
+cp tensorrtx/yolov5/gen_wts.py yolov5/gen_wts.py
+```
+
+4. Generate wts file
+```
+cd yolov5
+python3 gen_wts.py
+```
+
+yolov5s.wts file will be generated in yolov5 folder
+
+
+
+Note: if you want to generate wts file to another YOLOv5 model (YOLOv5m, YOLOv5l or YOLOv5x), edit get_wts.py file changing yolov5s to your model name
+```
+model = torch.load('weights/yolov5s.pt', map_location=device)['model'].float() # load to FP32
+model.to(device).eval()
+
+f = open('yolov5s.wts', 'w')
+```
+
+##
+
+### Convert wts file to TensorRT model
+1. Replace yololayer files from tensorrtx/yolov5 folder to yololayer and hardswish files from yolov5converter
+```
+mv yolov5converter/yololayer.cu tensorrtx/yolov5/yololayer.cu
+mv yolov5converter/yololayer.h tensorrtx/yolov5/yololayer.h
+```
+
+2. Move generated yolov5s.wts file to tensorrtx/yolov5 folder (example for YOLOv5s)
+```
+cp yolov5/yolov5s.wts tensorrtx/yolov5/yolov5s.wts
+```
+
+3. Build tensorrtx/yolov5
+```
+cd tensorrtx/yolov5
+mkdir build
+cd build
+cmake ..
+make
+```
+
+4. Convert to TensorRT model (yolov5s.engine file will be generated in tensorrtx/yolov5/build folder)
+```
+sudo ./yolov5 -s
+```
+
+5. Create a custom yolo folder and copy generated files (example for YOLOv5s)
+```
+mkdir /opt/nvidia/deepstream/deepstream-5.1/sources/yolo
+cp yolov5s.engine /opt/nvidia/deepstream/deepstream-5.1/sources/yolo/yolov5s.engine
+```
+
+
+
+Note: by default, yolov5 script generate model with batch size = 1, FP16 mode and s model.
+```
+#define USE_FP16 // comment out this if want to use FP32
+#define DEVICE 0 // GPU id
+#define NMS_THRESH 0.4
+#define CONF_THRESH 0.5
+#define BATCH_SIZE 1
+
+#define NET s // s m l x
+```
+Edit yolov5.cpp file before compile if you want to change this parameters.
+
+##
+
+### Compile nvdsinfer_custom_impl_Yolo
+1. Run command
+```
+sudo chmod -R 777 /opt/nvidia/deepstream/deepstream-5.1/sources/
+```
+
+2. Donwload [my external/yolov5 folder](https://github.com/marcoslucianops/DeepStream-Yolo/tree/master/external/yolov5-3.X) and move files to created yolo folder
+
+3. Compile lib
+
+* x86 platform
+```
+cd /opt/nvidia/deepstream/deepstream-5.1/sources/yolo
+CUDA_VER=11.1 make -C nvdsinfer_custom_impl_Yolo
+```
+
+* Jetson platform
+```
+cd /opt/nvidia/deepstream/deepstream-5.1/sources/yolo
+CUDA_VER=10.2 make -C nvdsinfer_custom_impl_Yolo
+```
+
+##
+
+### Testing model
+Use my edited [deepstream_app_config.txt](https://raw.githubusercontent.com/marcoslucianops/DeepStream-Yolo/master/external/yolov5-3.X/deepstream_app_config.txt) and [config_infer_primary.txt](https://raw.githubusercontent.com/marcoslucianops/DeepStream-Yolo/master/external/yolov5-3.X/config_infer_primary.txt) files available in [my external/yolov5-3.X folder](https://github.com/marcoslucianops/DeepStream-Yolo/tree/master/external/yolov5-3.X)
+
+Run command
+```
+deepstream-app -c deepstream_app_config.txt
+```
+
+
+
+Note: based on selected model, edit config_infer_primary.txt file
+
+For example, if you using YOLOv5x
+
+```
+model-engine-file=yolov5s.engine
+```
+
+to
+
+```
+model-engine-file=yolov5x.engine
+```
+
+##
+
+To change NMS_THRESH, edit nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp file and recompile
+
+```
+#define kNMS_THRESH 0.45
+```
+
+To change CONF_THRESH, edit config_infer_primary.txt file
+
+```
+[class-attrs-all]
+pre-cluster-threshold=0.25
+```
diff --git a/external/yolov5-3.X/config_infer_primary.txt b/external/yolov5-3.X/config_infer_primary.txt
new file mode 100644
index 0000000..ee008f0
--- /dev/null
+++ b/external/yolov5-3.X/config_infer_primary.txt
@@ -0,0 +1,18 @@
+[property]
+gpu-id=0
+net-scale-factor=0.0039215697906911373
+model-color-format=0
+model-engine-file=yolov5s.engine
+labelfile-path=labels.txt
+num-detected-classes=80
+interval=0
+gie-unique-id=1
+process-mode=1
+network-type=0
+cluster-mode=4
+maintain-aspect-ratio=0
+parse-bbox-func-name=NvDsInferParseCustomYoloV5
+custom-lib-path=nvdsinfer_custom_impl_Yolo/libnvdsinfer_custom_impl_Yolo.so
+
+[class-attrs-all]
+pre-cluster-threshold=0.25
diff --git a/external/yolov5-3.X/deepstream_app_config.txt b/external/yolov5-3.X/deepstream_app_config.txt
new file mode 100644
index 0000000..cd2a411
--- /dev/null
+++ b/external/yolov5-3.X/deepstream_app_config.txt
@@ -0,0 +1,63 @@
+[application]
+enable-perf-measurement=1
+perf-measurement-interval-sec=1
+
+[tiled-display]
+enable=1
+rows=1
+columns=1
+width=1280
+height=720
+gpu-id=0
+nvbuf-memory-type=0
+
+[source0]
+enable=1
+type=3
+uri=file://../../samples/streams/sample_1080p_h264.mp4
+num-sources=1
+gpu-id=0
+cudadec-memtype=0
+
+[sink0]
+enable=1
+type=2
+sync=0
+source-id=0
+gpu-id=0
+nvbuf-memory-type=0
+
+[osd]
+enable=1
+gpu-id=0
+border-width=1
+text-size=15
+text-color=1;1;1;1;
+text-bg-color=0.3;0.3;0.3;1
+font=Serif
+show-clock=0
+clock-x-offset=800
+clock-y-offset=820
+clock-text-size=12
+clock-color=1;0;0;0
+nvbuf-memory-type=0
+
+[streammux]
+gpu-id=0
+live-source=0
+batch-size=1
+batched-push-timeout=40000
+width=1920
+height=1080
+enable-padding=0
+nvbuf-memory-type=0
+
+[primary-gie]
+enable=1
+gpu-id=0
+gie-unique-id=1
+nvbuf-memory-type=0
+config-file=config_infer_primary.txt
+
+[tests]
+file-loop=0
diff --git a/external/yolov5-3.X/labels.txt b/external/yolov5-3.X/labels.txt
new file mode 100644
index 0000000..ca76c80
--- /dev/null
+++ b/external/yolov5-3.X/labels.txt
@@ -0,0 +1,80 @@
+person
+bicycle
+car
+motorbike
+aeroplane
+bus
+train
+truck
+boat
+traffic light
+fire hydrant
+stop sign
+parking meter
+bench
+bird
+cat
+dog
+horse
+sheep
+cow
+elephant
+bear
+zebra
+giraffe
+backpack
+umbrella
+handbag
+tie
+suitcase
+frisbee
+skis
+snowboard
+sports ball
+kite
+baseball bat
+baseball glove
+skateboard
+surfboard
+tennis racket
+bottle
+wine glass
+cup
+fork
+knife
+spoon
+bowl
+banana
+apple
+sandwich
+orange
+broccoli
+carrot
+hot dog
+pizza
+donut
+cake
+chair
+sofa
+pottedplant
+bed
+diningtable
+toilet
+tvmonitor
+laptop
+mouse
+remote
+keyboard
+cell phone
+microwave
+oven
+toaster
+sink
+refrigerator
+book
+clock
+vase
+scissors
+teddy bear
+hair drier
+toothbrush
diff --git a/external/yolov5-3.X/nvdsinfer_custom_impl_Yolo/Makefile b/external/yolov5-3.X/nvdsinfer_custom_impl_Yolo/Makefile
new file mode 100644
index 0000000..8dc0218
--- /dev/null
+++ b/external/yolov5-3.X/nvdsinfer_custom_impl_Yolo/Makefile
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+CUDA_VER?=
+ifeq ($(CUDA_VER),)
+ $(error "CUDA_VER is not set")
+endif
+CC:= g++
+NVCC:=/usr/local/cuda-$(CUDA_VER)/bin/nvcc
+
+CFLAGS:= -Wall -std=c++11 -shared -fPIC -Wno-error=deprecated-declarations
+CFLAGS+= -I../../includes -I/usr/local/cuda-$(CUDA_VER)/include
+
+LIBS:= -lnvinfer_plugin -lnvinfer -lnvparsers -L/usr/local/cuda-$(CUDA_VER)/lib64 -lcudart -lcublas -lstdc++fs
+LFLAGS:= -shared -Wl,--start-group $(LIBS) -Wl,--end-group
+
+INCS:= $(wildcard *.h)
+SRCFILES:= nvdsparsebbox_Yolo.cpp \
+ yololayer.cu
+
+TARGET_LIB:= libnvdsinfer_custom_impl_Yolo.so
+
+TARGET_OBJS:= $(SRCFILES:.cpp=.o)
+TARGET_OBJS:= $(TARGET_OBJS:.cu=.o)
+
+all: $(TARGET_LIB)
+
+%.o: %.cpp $(INCS) Makefile
+ $(CC) -c -o $@ $(CFLAGS) $<
+
+%.o: %.cu $(INCS) Makefile
+ $(NVCC) -c -o $@ --compiler-options '-fPIC' $<
+
+$(TARGET_LIB) : $(TARGET_OBJS)
+ $(CC) -o $@ $(TARGET_OBJS) $(LFLAGS)
+
+clean:
+ rm -rf $(TARGET_LIB)
+ rm -rf $(TARGET_OBJS)
diff --git a/external/yolov5-3.X/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp b/external/yolov5-3.X/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp
new file mode 100644
index 0000000..e38d4c1
--- /dev/null
+++ b/external/yolov5-3.X/nvdsinfer_custom_impl_Yolo/nvdsparsebbox_Yolo.cpp
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "nvdsinfer_custom_impl.h"
+
+#include