nexthumans
@nexthumans
Students
161
Reviews
15
Course Rating
4.9
Posts
Q&A
์ง๋ฌธ์์ต๋๋ค.
๋ค^^ ์ ํ ์๊ด์์ต๋๋ค ์ด๊ณตํ์ธ์~
- 0
- 2
- 25
Q&A
๊ฐ์ ์ฝ๋ ์์ฒญ ๋ฐ ์ง๋ฌธ
๊ฐ์์ ์ ์ฉ๋ ๋ชจ๋ธ์ "์ ์/๋ถ๋'์ ์ด์ง ๋ถ๋ฅํ๋ ๊ตฌ์กฐ๋ก ์ค๊ณ๋์ด ์์ด, "์ด ์ํ์ด ์ด์ํ๋ค/์๋๋ค"๋ฅผ ํ๋จํฉ๋๋ค.์ง๋ฌธ ํ์ ๊ฒ์ฒ๋ผ ๋ถ๋์์ญ์ ๋ฐ์ค(ROI)๋ก ํ์ํ๋ ค๋ฉด, ๋ถ๋ฅ ๋ชจ๋ธ์ด ์๋๋ผ,Object Detection(๊ฐ์ฒด ํ์ง) ๋ชจ๋ธ(์, YOLO, Faster R-CNN ๊ณ์ด)์ด๋Segmentation(๋ถํ )๊ธฐ๋ฐ ๋ถ๋ ์์ญ ํ์ง ๋ชจ๋ธ(์: U-Net ๊ณ์ด, anomaly segmentation)์ผ๋ก ์ค๊ณ๋ฅผ ๋ฐ๊พธ๊ณ , ๊ฐ ๋ถ๋ ์์ญ์ ๋ํด Bounding Box๋ ๋ง์คํฌ ๋ผ๋ฒจ์ ๋ค์ ๊ตฌ์ถํ๋ ์์ ์ด ํ์ํด์.๋ง์ฝ ์ถ๊ฐ ๋ผ๋ฒจ๋ง ์์ด '๋๋ต์ ์ธ ๋ถ๋ ์์น'๋ฅผ ๋ณด๊ณ ์ถ์ ๊ฒ์ด๋ผ๋ฉด,ํ์ฌ ๋ถ๋ฅ ๋ชจ๋ธ์ feature map ์ ํ์ฉํGrad-CAM / Class Activation Map(CAM) ๊ณผ ๊ฐ์ ๊ธฐ๋ฒ์ผ๋ก heatmap ํํ์ ์๊ฐํ๋ ๋น๊ต์ ๋น ๋ฅด๊ฒ ๊ฒํ ๊ฐ ๊ฐ๋ฅํด์. ๋ค๋ง, ์ด ๋ฐฉ์์ ์ ํํ ๋ฐ์ค ํ์๋ผ๊ธฐ๋ณด๋ค๋ '์์ฌ ๊ตฌ์ญ ๊ฐ์กฐ'์ ๊ฐ๊น์์.๋์์ด ๋์๊ธธ ๋ฐ๋๋๋ค. ๊ฐ์์ฝ๋๋ ์ด๋ฉ์ผ๋ก ๋ณด๋ด๋๋ ธ์ต๋๋ค. ์ด๊ณตํ์ธ์~
- 0
- 2
- 39
Q&A
์์ ์๋ฃ ์์ฒญ์ ๋๋ค
์ด๋ฉ์ผ๋ก ๋ฉ์ผ ํ ํต ๋ณด๋ด์ฃผ์ธ์~ ๋ฐ๋ก ๋ณด๋ด๋๋ฆฌ๋๋ก ํ ๊ฒ์.
- 0
- 1
- 40
Q&A
end point ์์ฑ ๊ด๋ จ ์ง๋ฌธ๋๋ฆฝ๋๋ค!
"ํจ์น ์ ๋ฐ์ดํธ ๊ฐ์" ์น์ ์ ์ถ๊ฐํด์ ํด๋น ์ง๋ฌธ์ ๋ํ ๋์ฒ๋ฐฉ๋ฒ์ ์ฌ๋ ค๋์์ต๋๋ค.์์ ๋ต๋ณ์ด ๋ถ์กฑํ๋ฉด ์์์ ์ฐธ๊ณ ํ์๊ธฐ ๋ฐ๋๋๋ค. ๊ทธ๋ผ ์ด๊ณตํ์ธ์~
- 0
- 4
- 89
Q&A
์ฒดํ ๊ณ์ ์์๋ End-point ์์ฑ์ด ์ ๋๋๊ฑธ๊น์?
"ํจ์น ์ ๋ฐ์ดํธ ๊ฐ์" ์น์ ์ ์ถ๊ฐํด์ ํด๋น ์ง๋ฌธ์ ๋ํ ๋์ฒ๋ฐฉ๋ฒ์ ์ฌ๋ ค๋์์ต๋๋ค.์์ ๋ต๋ณ์ด ๋ถ์กฑํ๋ฉด ์์์ ์ฐธ๊ณ ํ์๊ธฐ ๋ฐ๋๋๋ค. ๊ทธ๋ผ ์ด๊ณตํ์ธ์~
- 0
- 2
- 75
Q&A
end point ์์ฑ ๊ด๋ จ ์ง๋ฌธ๋๋ฆฝ๋๋ค!
์์ธ์ ํ์ ํ์ต๋๋ค.Databricks ์ธก์์ ๊ธฐ์กด์ legacy serving ์ ์์ ๊ณ ์๋กญ๊ฒ Mosaic AI Model Serving ์ผ๋ก ์ ์ฑ ์ ๋ฐ๊พธ๋ฉด์, ์ฌ์ฉ์์ ML/DL ๋ชจ๋ธ์ ๋ฌผ๋ก , LLM ๋ชจ๋ธ๋ค์ ํ ๊ณณ์์ ๋ชจ๋ Serverless Model Serving ์ ํ๋๋ก ํด ๋์๋ค์.์ฐพ์๋ณด๋, ๊ธฐ์กด์ serving ์ผ๋ก ์ฌ๋ ค๋์ ๋ชจ๋ธ๋ค์ด run_id ๊ฐ ๊ทธ๋๋ก ์ด์ ์์์๋ ๋ถ๊ตฌํ๊ณ endpoint ๋ฅผ ์ข ์ ์ฒ๋ผ ์ด์ฉํ ์ ์๊ฒ ๋ฐ๊พธ์ด ๋์์ต๋๋ค. ์์ฌ์ด ์ ์ Mosaic AI Model Serving ์ด ์ ๋ฃ๋ผ๋ ์ ์ด๋ค์.https://www.databricks.com/product/pricing/model-serving ๊ทธ๋ ๊ธฐ์ ์ ๋ฃ ๊ณ์ ์ผ๋ก ์ฌ์ฉํ๊ณ ์์ผ๋ create endpoint ๊ฐ ๋์ํ์ง ์์ ๊ฑฐ์์. pricing ์ ํ์ธํด ๋ณด๋ฉด ๋น์ฉ์ ๋งค์ฐ ์ ๋ ดํ ํธ์ด๋ผ ํ์ต์ฉ์ผ๋ก ์ฝ๊ฐ ์ด์ฉํ๋ ์์ค์ด๋ผ๋ฉด ๋ถ๋ด์ ์์ ๊ฒ์ผ๋ก ๋ณด์ฌ์. serverless serving ์ด ํน์ง์ด๋ค๋ณด๋, create endpoint ๋ฅผ ๋๋ฅด๋ฉด container ๋ ์ง์คํธ๋ฆฌ๊ฐ ์์ฑ๋๋ฉฐ REST API๋ก ์๋ํฌ์ธํธ๊ฐ ์ ๊ณต๋์ด, ์ข ์ ๋ณด๋ค ํจ์ฌ ํธํ๊ฒ ๋ชจ๋ธ์ ์ด์ฉํ ์ ์๋ค๋ ์ ์ด ๊ฐ์ฅ ํฐ ์ฅ์ ์ ๋๋ค.
- 0
- 4
- 89
Q&A
end point ์์ฑ ๊ด๋ จ ์ง๋ฌธ๋๋ฆฝ๋๋ค!
๋ฐ์ดํฐ๋ธ๋ฆญ์ค๊ฐ ์ ๋ฐ์ดํธ๋๋ฉด์ ๋ฐ์ํ๋ ํ์์ธ๊ฒ ๊ฐ์๋ฐ์, ํ์ธํด๋ณด๊ณ ์ฐ๋ฝ๋๋ฆฌ๋๋ก ํ ๊ฒ์~
- 0
- 4
- 89
Q&A
์ด๋ฏธ์ง ๋ ธ์ด์ฆ ์ถ๊ฐํ๋ ์ฝ๋ ๊ณต์ ๋ถํ๋๋ฆฝ๋๋ค.
์๋ ํ์ธ์~๋ง์ด ๋ต๋ตํ์ จ๊ฒ ๋ค์.ํ์ํ์ ์ฝ๋๋ฅผ ๊ณต์ ํฉ๋๋ค~import numpy as np import matplotlib.pyplot as plt from PIL import Image, ImageDraw from pathlib import Path def load_image(file_path: Path) -> np.array: """ Load an image from a given file path and convert it to a NumPy array. Args: file_path (Path): Path to the image file. Returns: np.array: The image as a NumPy array. """ pil_image = Image.open(file_path) return np.array(pil_image) def add_irregular_patch(noisy_image: np.array, patch_pixels: int, noise_value: int) -> np.array: """ Adds an irregular, polygonal noise patch to the image. Args: noisy_image (np.array): The image array to modify. patch_pixels (int): Approximate area of the noise patch in pixels. noise_value (int): Noise value (255 for salt, 0 for pepper). Returns: np.array: The modified image with the noise patch added. """ img_pil = Image.fromarray(noisy_image) draw = ImageDraw.Draw(img_pil) img_width, img_height = img_pil.size # Estimate an average radius from the patch area (area โ ฯrยฒ) r = int(np.sqrt(patch_pixels / np.pi)) r = max(r, 5) # Ensure a minimum patch size # Choose a random center where the patch can fit center_x = np.random.randint(r, img_width - r) center_y = np.random.randint(r, img_height - r) # Random number of vertices for the irregular polygon num_points = np.random.randint(5, 10) angles = np.linspace(0, 2 * np.pi, num_points, endpoint=False) angles += np.random.uniform(0, 2 * np.pi / num_points, size=num_points) # Generate random radii for each vertex around the average radius radii = np.random.uniform(0.5 * r, 1.5 * r, size=num_points) # Create the polygon points points = [ (int(center_x + radius * np.cos(angle)), int(center_y + radius * np.sin(angle))) for angle, radius in zip(angles, radii) ] # Set the fill color based on image mode fill_color = (noise_value, noise_value, noise_value) if img_pil.mode == 'RGB' else noise_value draw.polygon(points, fill=fill_color) return np.array(img_pil) def random_patch_areas(total: int, num_patches: int) -> np.array: """ Split the total noise area into a random distribution of patch areas that sum to total. Args: total (int): Total number of noisy pixels for this noise type. num_patches (int): Number of patches. Returns: np.array: Array of patch areas. """ areas = np.random.rand(num_patches) areas = areas / areas.sum() # Normalize so areas sum to 1 areas = (total * areas).astype(int) # Adjust in case of rounding issues diff = total - areas.sum() areas[0] += diff return areas def apply_random_irregular_noise(image: np.array, amount: float, salt_vs_pepper: float) -> np.array: """ Applies random irregular noise patches (both salt and pepper) to an image. Args: image (np.array): The original image. amount (float): Fraction of total image pixels to be noised. salt_vs_pepper (float): Fraction of noise that is salt (white). Returns: np.array: The noisy image. """ noisy = image.copy() total_pixels = image.shape[0] * image.shape[1] num_pixels = int(amount * total_pixels) # Calculate noise areas for salt and pepper num_salt = int(salt_vs_pepper * num_pixels) num_pepper = num_pixels - num_salt # Randomly determine number of patches (e.g., 1 to 3 patches) num_salt_patches = np.random.randint(1, 10) num_pepper_patches = np.random.randint(1, 10) # Split the noise area into patch areas salt_patch_areas = random_patch_areas(num_salt, num_salt_patches) pepper_patch_areas = random_patch_areas(num_pepper, num_pepper_patches) # Add salt noise patches for area in salt_patch_areas: noisy = add_irregular_patch(noisy, area, 255) # Add pepper noise patches for area in pepper_patch_areas: noisy = add_irregular_patch(noisy, area, 0) return noisy def plot_images(original: np.array, noisy: np.array) -> None: """ Plots the original and noisy images side by side. Args: original (np.array): The original image. noisy (np.array): The noisy image. """ fig, axes = plt.subplots(1, 2, figsize=(10, 5)) axes[0].imshow(original) axes[0].set_title("Original Image") axes[0].axis("off") axes[1].imshow(noisy) axes[1].set_title("Image with Random Irregular Noise Patches") axes[1].axis("off") plt.tight_layout() plt.show() def main(file_path:Path, amount:float, salt_vs_pepper:float): # Load the image image = load_image(file_path) # Apply the noise noisy_image = apply_random_irregular_noise(image, amount, salt_vs_pepper) pil_image = Image.fromarray(noisy_image) # save noisy image output_file_path = Path('noisy_frames') / f"{file_path.stem}_noisy{file_path.suffix}" output_file_path.parent.mkdir(exist_ok=True) pil_image.save(output_file_path, format='JPEG') # Display the original and noisy images plot_images(image, noisy_image) if __name__ == "__main__": file_path = Path('frames') / 'frame_0.jpg' amount = 0.01 # Fraction of image pixels to be noised salt_vs_pepper = 0.6 # Fraction of noise that is salt (white) main(file_path, amount, salt_vs_pepper)
- 1
- 3
- 70
Q&A
df ์์ ๋ฐ์ด๋๋ฆฌ ๊ฐ ์ด๋ฏธ์ง๋ก ์๋ณด์ด๋ ํ์
์๋ ํ์ธ์, ์ด๊ณต ํ์๋ ๋ชจ์ต ๋๋ฌด ๋ณด๊ธฐ ์ข์ต๋๋ค~^^ ์ผ๋จ, metadata ์ ์ฉ์๋ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. spark 3.3+ ์ด๋ฉด ๋ฉํ๋ฐ์ดํฐ๋ฅผ ํตํด display() ๋ฅผ ํตํด df ์ ์ด๋ฏธ์ง๋ฅผ ์ถ๋ ฅํ๋ ๊ฒ์ ์ ์์ ์ผ๋ก ์ด๋ฃจ์ด์ ธ์ผ ํฉ๋๋ค. ์ผ๋จ, ๋ ๊ฐ์ง๋ฅผ ์์ฌํด ๋ณผ ์ ์๊ฒ ๋ค์. 1. path.replace("dbfs:", "") ๋ถ๋ถ์ด ๋ฌธ์ ๊ฐ ์์ด ๋ณด์ด๋ค์. /dbfs ๊ฐ ๋ฐ์ดํฐ๋ธ๋ฆญ์ค ๋ณผ๋ฅจ์ ๊ธฐ๋ณธ ๋จ์์ผํ ๋ฐ, ์ด๊ฒ์ ์ญ์ ํ ๊ฒ์ด ๋ฌธ์ ๊ฐ ๋๋ ์ง ์ฒดํฌํด ๋ณด์ธ์. from PIL import Image ํธ์ถ์ด ์๋์ด ์๋๋ฐ, ์ด ๋ถ๋ถ๋ ์ฒดํฌ ํ ๋ฒ ํด ๋ณด์๊ตฌ์.์ด๋ ๊ฒ ํด์๋ ํด๊ฒฐ์ด ์๋๋ค๋ฉด,pandas_udf ๋ก ๋ง๋ค๊ธฐ ์ ์ ์ํ ๊ฒฝ๋ก ํ๋๋ฅผ ๊ฐ์ง๊ณ ์ ์์ ์ผ๋ก ์๋ํ๋ ์ง ํ์ธ ํ์ ์ต์ข ์ ์ผ๋ก ์ฌ์ฉํ๋ฉด udf๋ก ๋ง๋ค์ด ์ฌ์ฉํ๋ค๋ฉด ์๋ง ์ค๋ฅ๋ฅผ ์ก์๋ผ ์ ์์ง ์์๊น ์๊ฐํฉ๋๋ค. ๊ทธ๋ผ ์ด๊ณตํ์ธ์!
- 0
- 1
- 45
Q&A
์ฝ๋ ์๋ฃ ์์ฒญ
๋ค, ์ด๋ฉ์ผ ๋ณด๋์ต๋๋ค. ํ์ธํด ๋ณด์ธ์.์ด๊ณต!
- 0
- 2
- 62




