This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%cd /mydrive/customTF2/data/ | |
'''********************************** | |
FOR FLOATING-POINT INFERENCE | |
**********************************''' | |
import tensorflow as tf | |
saved_model_dir = '/mydrive/customTF2/data/tflite/saved_model' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tflite_support.metadata_writers import object_detector | |
from tflite_support.metadata_writers import writer_utils | |
from tflite_support import metadata | |
import flatbuffers | |
import os | |
from tensorflow_lite_support.metadata import metadata_schema_py_generated as _metadata_fb | |
from tensorflow_lite_support.metadata.python import metadata as _metadata | |
from tensorflow_lite_support.metadata.python.metadata_writers import metadata_info | |
from tensorflow_lite_support.metadata.python.metadata_writers import metadata_writer | |
from tensorflow_lite_support.metadata.python.metadata_writers import writer_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Loading the saved_model | |
import tensorflow as tf | |
import time | |
import numpy as np | |
import warnings | |
warnings.filterwarnings('ignore') | |
from PIL import Image | |
from google.colab.patches import cv2_imshow | |
from object_detection.utils import label_map_util | |
from object_detection.utils import visualization_utils as viz_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
from __future__ import print_function | |
from __future__ import absolute_import | |
import os | |
import io | |
import pandas as pd | |
import tensorflow as tf | |
import argparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RUNNING INFERENCE | |
import numpy as np | |
import os | |
import cv2 | |
import six.moves.urllib as urllib | |
import sys | |
import tarfile | |
import tensorflow as tf | |
import zipfile | |
from google.colab.patches import cv2_imshow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
classes = 2 | |
train = data/train.txt | |
valid = data/test.txt | |
names = data/obj.names | |
backup = /mydrive/yolov4/training |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob, os | |
# Current directory | |
current_dir = os.path.dirname(os.path.abspath(__file__)) | |
print(current_dir) | |
current_dir = 'data/obj' | |
# Percentage of images to be used for the test set |