Skip to content

Instantly share code, notes, and snippets.

View tamnguyenvan's full-sized avatar

Tam Nguyen tamnguyenvan

  • Ha Noi Viet Nam
View GitHub Profile
@tamnguyenvan
tamnguyenvan / slice_assignment.py
Created April 20, 2020 02:59
Tensorflow slice assignment.
import tensorflow as tf
# tf.enable_eager_execution() # uncomment if tf version < 2.0
def assign(x, slices, values):
"""Assign slicing-tensor to the given values.
Args
:x: A `Tensor` as input.
:slices: A `Tensor`, `list` or `numpy array` indicates the region
@tamnguyenvan
tamnguyenvan / detect_with_tiling.py
Last active August 30, 2021 01:32
detect with tiling
import argparse
import os
import platform
import shutil
import time
from pathlib import Path
import math
import cv2
import torch
"""trt_yolo.py
This script demonstrates how to do real-time object detection with
TensorRT optimized YOLO engine.
"""
import os
import time
import argparse
from pyfaust.fact import palm4msa
from pyfaust.factparams import ParamsPalm4MSA, ConstraintList, StoppingCriterion
import numpy as np
# M = np.random.rand(500, 32)
# M = np.arange(500*32).reshape((500, 32)).astype('float64')
M = np.arange(100).reshape((10, 10)).astype('float64')
print(M)
# cons = ConstraintList('splin', 5, 500, 32, 'normcol', 1.0, 32, 32)
cons = ConstraintList('sp', 20, 10, 10, 'sp', 20, 10, 10)
import argparse
import math
from copy import deepcopy
from pathlib import Path
import torch
import torch.nn as nn
from models.common import *
from models.experimental import MixConv2d, CrossConv, C3
import argparse
import math
from copy import deepcopy
from pathlib import Path
import torch
import torch.nn as nn
from models.common import *
from models.experimental import MixConv2d, CrossConv, C3
"""
Copyright (C) 2018-2019 Intel Corporation
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
"""
Copyright (C) 2018-2019 Intel Corporation
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
import numpy as np
import logging
import pathlib
import xml.etree.ElementTree as ET
import cv2
import os
class VOCDataset:
set nocompatible
filetype off
call plug#begin()
Plug 'preservim/nerdtree'
Plug 'kien/ctrlp.vim'
Plug 'tpope/vim-commentary'