This file contains hidden or 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
    
  
  
    
  | #!/usr/bin/env python3 | |
| from pathlib import Path | |
| import asyncio, tempfile, shutil, os | |
| from typing import List, Tuple | |
| from moviepy.editor import ( | |
| VideoFileClip, TextClip, CompositeVideoClip, | |
| AudioFileClip, CompositeAudioClip | |
| ) | |
| import pysubs2 | 
  
    
      This file contains hidden or 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
    
  
  
    
  | from moviepy.editor import VideoFileClip, TextClip, CompositeVideoClip | |
| import pysubs2 | |
| FONT_PATH = "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc" # Linux | |
| # FONT_PATH = "C:/Windows/Fonts/msjh.ttc" # Windows | |
| # FONT_PATH = "/Library/Fonts/PingFang.ttc" # macOS | |
| # FONT_PATH = "/System/Library/Fonts/STHeiti Light.ttc" # macOS | |
| video = VideoFileClip("./2-1.mp4") | 
  
    
      This file contains hidden or 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
    
  
  
    
  | #!/usr/bin/env python3 | |
| # -*- coding: utf-8 -*- | |
| import re | |
| import sys | |
| import json | |
| import argparse | |
| from pathlib import Path | |
| from typing import List, Tuple, Optional | 
  
    
      This file contains hidden or 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
    
  
  
    
  | from pycocotools.coco import COCO | |
| from pycocotools.cocoeval import COCOeval | |
| import argparse | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| def coco_eval(args): | |
| cocoGt = COCO(args.gt_json) | |
| cocoDt = cocoGt.loadRes(args.pred_json) | |
| cocoEval = COCOeval(cocoGt, cocoDt, args.eval_type) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | # https://github.com/developer0hye/PyTorch-Darknet53 | |
| import torch | |
| from torch import nn | |
| def conv_batch(in_num, out_num, kernel_size=3, padding=1, stride=1): | |
| return nn.Sequential( | |
| nn.Conv2d(in_num, out_num, kernel_size=kernel_size, stride=stride, padding=padding, bias=False), | |
| nn.BatchNorm2d(out_num), | |
| nn.LeakyReLU()) | 
  
    
      This file contains hidden or 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
    
  
  
    
  | # https://blog.csdn.net/weixin_43397208/article/details/131352685 | |
| import torch | |
| import torch.nn as nn | |
| class IdentityBlock(nn.Module): | |
| def __init__(self, in_channel, kl_size, filters): | |
| super(IdentityBlock, self).__init__() | 
  
    
      This file contains hidden or 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
    
  
  
    
  | # jpg files | |
| a=1 | |
| for i in *.jpg; do | |
| new=$(printf "%04d.jpg" "$a") | |
| mv -i -- "$i" "$new" | |
| let a="$a+1" | |
| done | |
| # xml files | |
| a=1 | 
  
    
      This file contains hidden or 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
    
  
  
    
  | layer filters size input output | |
| 0 conv 32 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 32 | |
| 1 conv 64 3 x 3 / 2 416 x 416 x 32 -> 208 x 208 x 64 | |
| 2 conv 32 1 x 1 / 1 208 x 208 x 64 -> 208 x 208 x 32 | |
| 3 conv 64 3 x 3 / 1 208 x 208 x 32 -> 208 x 208 x 64 | |
| 4 Shortcut Layer: 1 | |
| 5 conv 128 3 x 3 / 2 208 x 208 x 64 -> 104 x 104 x 128 | |
| 6 conv 64 1 x 1 / 1 104 x 104 x 128 -> 104 x 104 x 64 | |
| 7 conv 128 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 128 | |
| 8 Shortcut Layer: 5 | 
  
    
      This file contains hidden or 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
    
  
  
    
  | # In[98]: | |
| import os | |
| from os.path import splitext | |
| from collections import Counter | |
| def compare(path): | |
| # List containing all file names + their extension in path directory | |
| myDir = os.listdir(path) | |
| # List containing all file names without their extension | |
| l = [splitext(filename)[0] for filename in myDir] | 
  
    
      This file contains hidden or 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
    
  
  
    
  | # In[98]: | |
| import pandas as pd | |
| import os, glob | |
| import sys | |
| import shutil | |
| import numpy as np | |
| import cv2 | |
| # In[98]: | 
NewerOlder