AIGC

+++ title = ‘AIGC’ tags = [“AI”] draft = false +++ Image Stable Diffusion text_encoder: Stable Diffusion uses CLIP, but other diffusion models may use other encoders such as BERT tokenizer: must match the one used by the text_encoder model scheduler: the scheduling algorithm used to progressively add noise to the image during training unet: the model used to generate the latent representation of the input vae: autoencoder module that we’ll use to decode latent representations into real images Tutorial Generative Modeling by Estimating Gradients of the Data Distribution The Annotated Diffusion Model Stable Diffusion with Diffusers Install conda create --name=ai python=3.10.9 sudo apt install nvidia-cuda-toolkit pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 pip install transformers noglob pip3 install diffusers["torch"] pip install -U xformers Colab How to Use Stable Diffusion to Generate Images Stable diffusion web-ui References ...

January 1, 2000

Autonomous Vehicles

Definitions 开环 闭环 在环 回灌 PCAP:网络数据包 PCD文件:点云帧 CAN/CANFD: 总线数据包和车载以太网数据包 Tutorials 知乎 - 自动驾驶学习资料合集 Github - Road-To-Autonomous-Driving Birds-eye-view-Perception To Read Tesla FSD专利全栈解读 如何打造自动驾驶的数据闭环?(上) Data Lake https://www.youtube.com/watch?v=Sguvhvwn8m4&list=PL-gIUf9e9CCtGr_zYdWieJhiqBG_5qSPa https://www.youtube.com/watch?v=MaQQmjtFUK8 https://aws.amazon.com/blogs/architecture/field-notes-building-an-autonomous-driving-and-adas-data-lake-on-aws/ Iceberg https://iceberg.apache.org/spark-quickstart/ AVOps https://learn.microsoft.com/en-us/azure/architecture/example-scenario/automotive/autonomous-vehicle-operations-dataops https://aws.amazon.com/cn/blogs/china/autonomous-driving-data-lake-scene-detection/ https://juicefs.com/zh-cn/blog/user-stories/li-autos-practice-of-migrating-data-from-hdfs-to-juicefs https://cloud.tencent.com/developer/article/2193529 https://www.cnblogs.com/yunqishequ/p/16876242.html https://chejiahao.autohome.com.cn/info/14983089 https://www.slidestalk.com/AWS.User_Group/59655?video https://developer.aliyun.com/article/1103513 https://learn.microsoft.com/zh-cn/azure/architecture/solution-ideas/articles/avops-architecture https://github.com/aws-samples/aws-autonomous-driving-data-lake-ros-bag-visualization-using-rviz https://www.databricks.com/dataaisummit/session/building-data-lakehouse-manage-pbs-autonomous-vehicle-data

January 1, 2000

Coding

Tools Install pnpm install -g @anthropic-ai/claude-code pnpm install -g @openai/codex@latest pnpm install -g @google/gemini-cli pnpm install -g @qwen-code/qwen-code@latest Update pnpm update -g @anthropic-ai/claude-code # update all pnpm update -g Claude Code Doc Claude Code Usage: ctrl + v: paste image from clipboard shift + tab: plan mode/edit mode Qwen Coder Github - Qwen Code Codex Doc: Github - Codex Codex Gemini-CLI gemini-cli.dev Google AI Studio Google AI Studio MCP Github - Model Context Protocol servers MCP Market Higress ModelScope - MCP Plaza Github - Awesome MCP Servers Zen MCP Server Github - MCP Chrome MCPs Git Context7 MCP Chrome Spec Engineering Github - OpenSpec Github - spec-kit Github - BMAD-METHOD AGENTS.md Agents.md Github - Agents.md Github - Agent.md Github - awesome-copilot Spec Driven Workflow v1 Outline Project overview Build and test commands Code style guidelines Testing instructions Security considerations Template <Project Description> ## Architecture Frontend: Next.js with TypeScript Styling: Tailwind CSS Package manager: pnpm Database: MySQL ## Development Environment - Python: - use `uv run` to run python scripts, use `uv add --script <script.py> <package>` to solve dependcies, use `uv run --with <package> -- python -c ` to run ad-hoc python code - Data Warehouse: - use `mysql -h fe-c-ca4b4d642153fa7e-internal.starrocks.aliyuncs.com -P 9030 -ureadonly -p'V@!KG0fG' -Dpaimon.default` to inspect table and data - Object Storage: - use `rclone lsd oss:<bucket_name>/path/to/data` to inspect data in object storage

January 1, 2000

Computer Vision

Face Detection retina face Github - retinaface: deep learning based cutting-edge facial detector deepface Github - deepface: a lightweight face recognition and facial attribute analysis (age, gender, emotion and race) framework Install: pip install deepface Usage: from deepface import DeepFace # Detection: 从照片中检测人脸 face_objs = DeepFace.extract_faces( img_path = "img.jpg", detector_backend = 'retinaface', # retina face 检测效果较好 align = False, enforce_detection = False, ) # Verification: 判断两张图片是否同一个人 result = DeepFace.verify(img1_path = "img1.jpg", img2_path = "img2.jpg") # 默认会先做 detection,如果是已经提取了人脸的照片可以用 result = DeepFace.verify(img1_path = "img1.jpg", img2_path = "img2.jpg", detector_backend='skip') # 指定相似度阈值 result = DeepFace.verify(img1_path = "img1.jpg", img2_path = "img2.jpg", threshold=0.5) # Embedding: 提取人脸 embedding,可以用于后续的对比计算 embedding_objs = DeepFace.represent(img_path = "img.jpg") # Recognition: 人脸识别,从人脸库中找出最符合的人 dfs = DeepFace.find( img_path = "img1.jpg", db_path = "./workspace/my_db", model_name = "VGG-Face", # 默认模型是 VGG-Face ) # Analysis:提取脸部特征(年龄、性别、情绪等) objs = DeepFace.analyze( img_path = "img4.jpg", actions = ['age', 'gender', 'race', 'emotion'], )

January 1, 2000

Datasets

SelectDataset

January 1, 2000

Graph

Libraries DGL (Deep Graph Library) References Overview of DGL Pytorch Geometric Documentation Networkx # import import networkx as nx # load adjacency matrix G = nx.from_numpy_matrix(A) # get adjacency matrix A = nx.adjacency_matrix(G) A = nx.adjacency_matrix(G).todense() # drawing fig = plt.figure(figsize=(10,8)) ax = plt.subplot(111) pos = nx.spring_layout(G) #pos = nx.kamada_kawai_layout(G) nx.draw(G, ax=ax, pos=pos, node_size=10, node_color=colors, alpha=0.5, with_labels=True) # or nx.draw_networkx_nodes(G, ax=ax, pos=pos, node_size=100, node_color=colors, alpha=0.5) nx.draw_networkx_edges(G, ax=ax, pos=pos, alpha=0.1) # Laplacian Matrix lap = nx.linalg.laplacianmatrix.laplacian_matrix(G) lap = nx.linalg.laplacianmatrix.normalized_laplacian_matrix(G) # N=D^(-1/2)LD^(-1/2) # connected components nx.algorithms.components.number_connected_components(G) # relabel G = nx.relabel_nodes(G, lambda x: int(x[1:])) # get weights for n, nbrs in G.adj.items(): for nbr, eattr in nbrs.items(): wt = eattr['weight'] print('(%d, %d, %.3f)' % (n, nbr, wt)) for (u, v, wt) in G.edges.data('weight'): print('(%d, %d, %.3f)' % (u, v, wt)) # shorest path nx.shorest_paht(G, source, target) nx.shorest_paht_length(G, source, target) Projects deepwalk node2vec GraphEmbedding GraphSAGE graphsage-simple karateclub SINE Overlapping Community Detection with Graph Neural Networks

January 1, 2000

LLM

Ideas 3 levels Use chatgpt to do job make tools to facilitate the workflow of using chatgpt improve model to do job LLM Learning things by induction, Human can learn by deduction Learning Papers Recent Advances in Natural Language Processing via Large Pre-Trained Language Models- A Survey Articles 拆解追溯 GPT-3.5 各项能力的起源 Generative AI exists because of the transformer Prompt Engineering Prompting Principles Principle 1: Write clear and specific instructions Use delimiters to clearly indicate distinct parts of the input Ask for a structured output Ask the model to check whether conditions are satisfied “Few-shot” prompting Principle 2: Give the model time to “think” Specify the steps required to complete a task Instruct the model to work out its own solution before rushing to a conclusion Iterative Prompt Development ...

January 1, 2000

NLP

Terms NLU (Natural Language Understanding) / NLI (Natural Language Inferencing) NLG (Natural Language Generation) Tokenization (分词) Chinese Word Segmentation (中文分词) BPE/wordpiece/unigram Stemming (词干提取) Lemmatization (词形还原) Parts of speech tagging (词性标注) Named-entity Recognition (NER,命名实体识别) Chunking (分块) Language Model: A language model is a function that takes in a sequence of words and returns a probility distribution over all the possible next words in that sequence. autoregressive/causal language model masked language model (BERT) ...

January 1, 2000

Numpy-Pandas-SciPy

Numpy-Pandas-SciPy Numpy Basic Import import numpy as np Get shape x.shape Meshgrid x = np.arange(-5, 5, 0.1) y = np.arange(-5, 5, 0.1) xx, yy = np.meshgrid(x, y) z = np.sin(xx**2 + yy**2) / (xx**2 + yy**2) h = plt.contourf(x,y,z) Sort np.argmax(x) np.argsort(x) Matrix # change axes xx.transpose(1,0,2) Random Generate random samples # generate random integers over [low, high) with size d0*d1 from a uniform dist x = np.random.randint(low, high, (d0, d1)) # generate d0*d1*d2 samples from a uniform distribution over [0, 1) x = np.random.rand(d0, d1, d2) # generate d0*d1*d2 samples from a normal distribution over [0, 1) x = np.random.randn(d0, d1, d2) # generate n samples from a uniform distribution over [0, 1) x = np.random.random(n) x = np.random.sample(n) x = np.random.random_sample(n) x = np.random.randf(n) Make random choice ...

January 1, 2000

Products

Cherry Studio Cherry Studio - 项目简介 Claude Code Claude Docs Claude Code overview - Getting Started Model Context Protocol (MCP) Engineering at Anthropic: Inside the team building reliable AI systems Codex Codex CLI Gemini CLI Gemini CLI - documentation WisprFLow WisprFLow

January 1, 2000