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
// | |
// ListScrollingProxy.swift | |
// | |
// Created by gurkan soykan on 20.05.2022. | |
// | |
// source: https://stackoverflow.com/questions/60855852/how-to-scroll-list-programmatically-in-swiftui/60855853#60855853 | |
import Foundation | |
import UIKit |
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 matplotlib.pyplot as plt | |
import matplotlib.patches as patches | |
from PIL import Image | |
# source: https://stackoverflow.com/a/37437395/8265079 | |
x_0, y_0, x_1, y_1 = annotation_item['bounding_box'] | |
im = Image.open('my_img.png') | |
# Create figure and axes |
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
def get_iou(a, b, epsilon=1e-5): | |
""" Given two boxes `a` and `b` defined as a list of four numbers: | |
[x1,y1,x2,y2] | |
where: | |
x1,y1 represent the upper left corner | |
x2,y2 represent the lower right corner | |
It returns the Intersect of Union score for these two boxes. | |
source: http://ronny.rest/tutorials/module/localization_001/iou/ | |
Args: |
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
# Importing Image class from PIL module | |
from PIL import Image | |
# Opens a image in RGB mode | |
im = Image.open(r"C:\Users\Admin\Pictures\network.png") | |
# Setting the points for cropped image | |
left = 155 | |
top = 65 | |
right = 360 |
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
ssh -C [email protected] ncdu -o- /kuacc/users/gsoykan20 | ncdu -f- |
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 cv2 | |
import numpy as np | |
import torch | |
# Create a random torch tensor | |
tensor = torch.randn(3, 256, 256) | |
# Convert the tensor to a numpy array | |
numpy_image = tensor.numpy() |
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 pytorch_lightning as pl | |
from torch.optim import Adam | |
from torch.optim.lr_scheduler import StepLR | |
class MyModel(pl.LightningModule): | |
def __init__(self): | |
super().__init__() | |
self.layer1 = nn.Linear(10, 5) | |
self.layer2 = nn.Linear(5, 1) | |
self.loss_fn = nn.MSELoss() |
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
def draw_line_in_mask(mask, start_point, end_point): | |
# Extract x and y coordinates of start and end points | |
x0, y0 = start_point[0], start_point[1] | |
x1, y1 = end_point[0], end_point[1] | |
# Compute differences between start and end points | |
dx = abs(x1 - x0) | |
dy = abs(y1 - y0) | |
# Determine direction of the line |
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
def draw_line_in_mask_batched(self, mask, start_point, end_point, light_neighboring=True): | |
""" | |
Draws a line in the given batch of masks. | |
Args: | |
mask (torch.Tensor): Batch of masks with shape (B, H, W) | |
start_point (List of Tuples): Batch of start points with shape (B, 2) | |
end_point (List of Tuples): Batch of end points with shape (B, 2) | |
Returns: |
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
find . -name "*.py" -exec python {} \; |
OlderNewer