Over 10 years we help companies reach their financial and branding goals. Engitech is a values-driven technology agency dedicated.

Gallery

Contacts

411 University St, Seattle, USA

engitech@oceanthemes.net

+1 -800-456-478-23

Development Technology

Capture, label and set up your custom object detection in TF 2.7.0



My name is HDX and i’m not a native english speaker so bear with me. I will try to help you set up your image classifier and object detector process from scratch in 30 minutes

Nicholas Rennote Channel:
https://www.youtube.com/c/NicholasRenotte
The original Mask detection tutorial

Pal ingeniero channel: https://www.youtube.com/channel/UCTL8_Xr6vzTmCU2h3reHgPw/featured

COMMANDS ON THE PINNED COMMENT
Youtube will mess some of the commands with dashes

Chapters:
0:00 Intro and Prerequisites
1:02 Disclaimer and reasoning
1:43 Setting up Tensorflow2 Environment
2:27 Installing Tensorflow2
2:40 CUDA Support
7:06 Testing CUDA support on your TF2 env
7:20 Installing the Object detection library
11:14 Testing for Object detection functionality
11:57 Creating a new environment for Labelimg and OpenCV
14:23 Installing Opencv for python
15:33 Setting up the image capture app
15:51 Capturing your data set
16:31 Preparing the data
17:32 Labeling the data
20:06 Separating data set for training
20:38 Switching back to your Tensorflow2 env
20:59 Cloning Nicholas Renotte Repo for object detection
21:10 Installing Jupyter on the Tensorflow env (IMPORTANT)
21:39 Fixing my data set mistakes
22:05 Setting your custom data set on the project workspace
22:26 Getting the necessary files and folders in place
23:10 Matching your XML tags to the label variable on the notebook
24:14 Correcting a few mistakes from the default notebook
24:46 Generating the train data that matches ROIs and TAGS
25:02 Copying the pipeline.config file to your workspace/model/my_ssd_mobnet path
25:38 Configuring the pre trained model
25:56 Script to train your model
26:23 Fixing CUDART64_101.DLL missing problem
27:16 Training your model with CUDA support
28:08 Fixing the OpenCV script to prevent hanging after quiting
28:32 Loading the trained model and testing

Leave a comment if you get stuck at some point 😛
Hope this helps!

—— Capture Code —–
import cv2
cam = cv2.VideoCapture(0,cv2.CAP_DSHOW)

cv2.namedWindow(“Test”)

imgCounter = 0

while True:
ret, frame = cam.read()
if not ret:
print (“Can’t access the camera/camera is already open by another app”)
break
cv2.imshow(“test”, frame)

k = cv2.waitKey(1)
if k%256 == 27: #If esc key is pressed
print (“program finished”)
break

elif k%256 == 32: #If space bar is pressed
img_name = “{}.png”.format(imgCounter)
cv2.imwrite(img_name, frame)
#print (“Writing: ” + img_name)
imgCounter += 1

cam.release()

cv2.destroyAllWindows()

Btw this program was lifted from stack overflows questions haha, not answers i just fixed it a bit lol. I’m sorry to start our relationship with a lie 😛

source

Author

MQ

Leave a comment

Your email address will not be published. Required fields are marked *