Skip to content

Instantly share code, notes, and snippets.

View LiUzHiAn's full-sized avatar
🎯
Focusing

LiUzHiAn

🎯
Focusing
View GitHub Profile
@LiUzHiAn
LiUzHiAn / cgm-gdm-sdm.py
Last active November 11, 2020 01:20
Conjugate gradient method, gradient descent method and steepest descent method implementation using python
import numpy as np
import time
from scipy.sparse.linalg import cg
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
def f(x, A, b, c):
return 0.5 * np.dot(x.T, np.dot(A, x)) - np.dot(b.T, x) + c
@LiUzHiAn
LiUzHiAn / inference_with_probs.py
Last active December 20, 2023 11:21
Get class probabilities for each detection during MMDetection inference phase
import copy
import cv2
import torch.nn.functional as F
import os.path as osp
import glob
import numpy as np
import torch
from mmdet.apis import init_detector, inference_detector
from mmcv.parallel import collate, scatter
from mmcv.ops.nms import batched_nms